Re: killing a script

2011-09-10 Thread Steven D'Aprano
Cameron Simpson wrote: > On 10Sep2011 11:25, Steven D'Aprano > wrote: > | Cameron Simpson wrote: > | > My copy of the 2.7 docs says: > | > This is implemented by calling the Standard C function system(), and > | > has the same limitations. > | > and sure enough, "man 3 system" says: > | > |

Re: killing a script

2011-09-10 Thread Nobody
On Sat, 10 Sep 2011 11:25:40 +1000, Steven D'Aprano wrote: >> and sure enough, "man 3 system" says: > > I don't consider having to look up documentation for a function in a > completely different language (in this case, C) as "documented behaviour of > os.system". Well, tough luck. os.system()

Re: killing a script

2011-09-10 Thread Cameron Simpson
On 10Sep2011 11:25, Steven D'Aprano wrote: | Cameron Simpson wrote: | > My copy of the 2.7 docs says: | > This is implemented by calling the Standard C function system(), and | > has the same limitations. | > and sure enough, "man 3 system" says: | | I don't consider having to look up docume

Re: killing a script

2011-09-09 Thread Chris Angelico
On Sat, Sep 10, 2011 at 11:25 AM, Steven D'Aprano wrote: >>   This is implemented by calling the Standard C function system(), and >>   has the same limitations. >> >> and sure enough, "man 3 system" says: > > I don't consider having to look up documentation for a function in a > completely differ

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Cameron Simpson wrote: > On 09Sep2011 22:16, Steven D'Aprano > wrote: > | Hans Mulder wrote: > | > On 9/09/11 11:07:24, Steven D'Aprano wrote: > | >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation > | >> of script.py. While script.py is running, it receives the Ctrl-C, the

Re: killing a script

2011-09-09 Thread Cameron Simpson
On 09Sep2011 22:16, Steven D'Aprano wrote: | Hans Mulder wrote: | > On 9/09/11 11:07:24, Steven D'Aprano wrote: | >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of | >> script.py. While script.py is running, it receives the Ctrl-C, the | >> calling process does not. | >

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Hans Mulder wrote: > On 9/09/11 11:07:24, Steven D'Aprano wrote: >> Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of >> script.py. While script.py is running, it receives the Ctrl-C, the >> calling process does not. > > You misinterpret what you are seeing: the calling pro

Re: killing a script

2011-09-09 Thread Hans Mulder
On 9/09/11 11:07:24, Steven D'Aprano wrote: Sure enough, I now have to hit Ctrl-C repeatedly, once per invocation of script.py. While script.py is running, it receives the Ctrl-C, the calling process does not. You misinterpret what you are seeing: the calling process *does* receive the ctrl-C,

Re: killing a script

2011-09-09 Thread Steven D'Aprano
Cameron Simpson wrote: > On 30Aug2011 14:13, Steven D'Aprano > wrote: > | On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: > | >> Yes, but if I am not mistaken, that will require me to put a line or > | >> two after each os.system call. That's almost like whack-a-mole at the > | >> code level

Re: killing a script

2011-09-08 Thread Cameron Simpson
On 30Aug2011 14:13, Steven D'Aprano wrote: | On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: | >> Yes, but if I am not mistaken, that will require me to put a line or | >> two after each os.system call. That's almost like whack-a-mole at the | >> code level rather than the Control-C level. O

Re: killing a script

2011-08-30 Thread Hans Mulder
On 30/08/11 06:13:41, Steven D'Aprano wrote: On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: [...] Yes, but if I am not mistaken, that will require me to put a line or two after each os.system call. That's almost like whack-a-mole at the code level rather than the Control-C level. OK, not

Re: killing a script

2011-08-29 Thread Steven D'Aprano
On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: [...] >> Yes, but if I am not mistaken, that will require me to put a line or >> two after each os.system call. That's almost like whack-a-mole at the >> code level rather than the Control-C level. OK, not a huge deal for >> one script, but I wa

Re: killing a script

2011-08-29 Thread Arnaud Delobelle
On 29 August 2011 04:08, Russ P. wrote: > On Aug 28, 7:51 pm, Chris Angelico wrote: >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: >> > On Aug 28, 6:52 pm, MRAB wrote: >> >> You could look at the return value of os.system, which may tell you the >> >> exit status of the process. >> >> > Th

Re: killing a script

2011-08-29 Thread Russ P.
On Aug 28, 8:16 pm, Chris Rebert wrote: > On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > > On Aug 28, 7:51 pm, Chris Angelico wrote: > >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > >> > On Aug 28, 6:52 pm, MRAB wrote: > >> >> You could look at the return value of os.system, which ma

Re: killing a script

2011-08-29 Thread Jason Swails
On Sun, Aug 28, 2011 at 10:41 PM, Russ P. wrote: > > > You could look at the return value of os.system, which may tell you the > > exit status of the process. > > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler way to just kill the "whole en

Re: killing a script

2011-08-29 Thread Thomas Jollans
On 2011-08-29 05:08, Russ P. wrote: Yes, but if I am not mistaken, that will require me to put a line or two after each os.system call. That's almost like whack-a-mole at the code level rather than the Control-C level. OK, not a huge deal for one script, but I was hoping for something simpler.

Re: killing a script

2011-08-28 Thread Nobody
On Sun, 28 Aug 2011 18:15:56 -0700, Russ P. wrote: > Is there a > simple way to ensure that the first Control-C will kill the whole darn > thing, i.e, the top-level script? Thanks. You might try using subprocess.Popen() or subprocess.call() rather than os.system(). os.system() calls the platform

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 8:16 pm, Chris Rebert wrote: > On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > > On Aug 28, 7:51 pm, Chris Angelico wrote: > >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > >> > On Aug 28, 6:52 pm, MRAB wrote: > >> >> You could look at the return value of os.system, which ma

Re: killing a script

2011-08-28 Thread Chris Rebert
On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > On Aug 28, 7:51 pm, Chris Angelico wrote: >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: >> > On Aug 28, 6:52 pm, MRAB wrote: >> >> You could look at the return value of os.system, which may tell you the >> >> exit status of the process. >>

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 7:51 pm, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > > On Aug 28, 6:52 pm, MRAB wrote: > >> You could look at the return value of os.system, which may tell you the > >> exit status of the process. > > > Thanks for the suggestion. Yeah, I guess I could do

Re: killing a script

2011-08-28 Thread Paul Rubin
"Russ P." writes: > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler way to just kill the "whole enchilada." > Hitting Control-C over and over is a bit like whacking moles. Hit Ctrl-Z, which stops execution of the subprogram but doesn't kill

Re: killing a script

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > On Aug 28, 6:52 pm, MRAB wrote: >> You could look at the return value of os.system, which may tell you the >> exit status of the process. > > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 6:52 pm, MRAB wrote: > On 29/08/2011 02:15, Russ P. wrote:> I have a Python (2.6.x) script on Linux > that loops through many > > directories and does processing for each. That processing includes > > several "os.system" calls for each directory (some to other Python > > scripts, other

Re: killing a script

2011-08-28 Thread MRAB
On 29/08/2011 02:15, Russ P. wrote: I have a Python (2.6.x) script on Linux that loops through many directories and does processing for each. That processing includes several "os.system" calls for each directory (some to other Python scripts, others to bash scripts). Occasionally something goes

killing a script

2011-08-28 Thread Russ P.
I have a Python (2.6.x) script on Linux that loops through many directories and does processing for each. That processing includes several "os.system" calls for each directory (some to other Python scripts, others to bash scripts). Occasionally something goes wrong, and the top-level script just k