Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21100

RE: HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied

Path csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.02; 'completeness': 0.05; 'subject:Error': 0.05; 'python': 0.08; 'dependant': 0.09; 'googled': 0.09; 'subprocess': 0.09; 'to:name :python-list@python.org': 0.15; '712': 0.16; 'currencies': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'subject: \n ': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'subject:] ': 0.18; 'header:In-Reply- To:1': 0.22; 'itself,': 0.23; 'command': 0.24; 'subject:HELP': 0.24; 'function': 0.27; 'tried': 0.27; 'received:169': 0.28; 'received:169.254': 0.28; 'separate': 0.28; 'bit': 0.28; 'problem': 0.29; 'received:155': 0.30; 'received:159': 0.30; 'terminate': 0.30; 'creates': 0.31; 'accuracy': 0.32; 'does': 0.32; 'error.': 0.32; 'test': 0.34; 'running': 0.34; 'probably': 0.35; 'to:addr:python-list': 0.35; 'phone:': 0.35; 'created': 0.37; 'but': 0.37; 'charset:us-ascii': 0.37; 'skip:" 10': 0.37; 'could': 0.38; 'doing': 0.38; 'put': 0.40; 'to:addr:python.org': 0.40; 'your': 0.61; 'hope': 0.61; 'subject': 0.61; 'offers': 0.62; 'information,': 0.69; 'legal': 0.72; 'url:email': 0.72; 'bank': 0.75; 'sale': 0.75; 'investment': 0.77; 'purchase': 0.78; '[error': 0.84; 'received:169.254.8': 0.84; 'subject:Access': 0.84; 'killing': 0.91; 'subject: ! ': 0.91
X-DKIM OpenDKIM Filter v2.1.3 sz1.jpmchase.com q21IG1r7014266
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=jpmorgan.com; s=smtpout; t=1330625761; bh=JtNIYSPxv9v283tl39bAnGYD/Mtuvg0fifwSzqX/mY0=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=KO73lXXPfflQyithotQwA6yY42QNa+3H2AOEfDCzOWd3TP0yt1cpBJoUNhJPZjURT ITg2TAt9YIB6lBOhVSivau2lIjjc/CuImlYnH+LAvuaW26sKgKPJePZwMrqieURLSg d1ChJdOM/PuRJUsSm39upxZpEmHdKlpgCWmlwq9s=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied
Thread-Topic HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied
Thread-Index AQHM99JY/2CDaWh6M0S5u845XtdQaJZVvhmA
Date Thu, 1 Mar 2012 18:15:55 +0000
References <CAOwQg9vx36AjJEgvC7z-TD0Ko93CHAHYfcUBAT0aGNXMo60XgA@mail.gmail.com>
In-Reply-To <CAOwQg9vx36AjJEgvC7z-TD0Ko93CHAHYfcUBAT0aGNXMo60XgA@mail.gmail.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.38]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.330.1330625771.3037.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1330625771 news.xs4all.nl 6919 [2001:888:2000:d::a6]:38183
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:21100

Show key headers only | View raw


> Now when I put "proc.terminate()" in my signal_handler() function to
> terminate the subprocess created as well,
> It is giving me "WindowsError: [Error 5] Access is denied" error.
> I have tried with os.kill() also, same error.  Tried with Popen.kill() also
> same error. Have googled a bit but couldn't understand them.
> 
> In general,  How to kill a subprocesses created from a python program.? If
> that subprocess also creates a new process from itself, how can I kill all
> child processes from my main python script.?

I have not tested this, but you could get the pid by doing Popen.pid and
then killing it from the command line by doing "taskkill /PID [pid]".
This is all dependant on the users ability to kill the task in the first place.
If that does not work then the problem is probably not Python but Windows.

You could test by running your program and doing the taskkill in a separate
command prompt. 

Hope that helps,
Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-03-01 18:15 +0000

csiph-web