Re: subprocess question re waiting

2013-04-08 Thread Dylan Evans
On Mon, Apr 8, 2013 at 10:22 PM, Dave Angel wrote: > On 04/08/2013 08:01 AM, Dylan Evans wrote: > >> On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin < >> al...@dpt-info.u-strasbg.fr >> >>> wrote: >>> >> >> loial writes: >>> >>> I want to call a child process to run a shell script and wait for

Re: subprocess question re waiting

2013-04-08 Thread Dave Angel
On 04/08/2013 07:00 AM, loial wrote: I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? Any help appreciated. import subprocess command = "/home/john/myscript" proces

Re: subprocess question re waiting

2013-04-08 Thread Dave Angel
On 04/08/2013 08:01 AM, Dylan Evans wrote: On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin wrote: loial writes: I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? [.

Re: subprocess question re waiting

2013-04-08 Thread Dylan Evans
On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin wrote: > loial writes: > > > I want to call a child process to run a shell script and wait for that > > script to finish. Will the code below wait for the script to finish? > > If not then how do I make it wait? > [...] > > process = subprocess.Pop

Re: subprocess question re waiting

2013-04-08 Thread Alain Ketterlin
loial writes: > I want to call a child process to run a shell script and wait for that > script to finish. Will the code below wait for the script to finish? > If not then how do I make it wait? [...] > process = subprocess.Popen(command, > stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=su

subprocess question re waiting

2013-04-08 Thread loial
I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? Any help appreciated. import subprocess command = "/home/john/myscript" process = subprocess.Popen(command, stdin=su

Re: subprocess question

2011-12-12 Thread Nobody
On Sun, 11 Dec 2011 22:02:23 -0800, Chris Rebert wrote: > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', > stdout=subprocess.PIPE) > Alternatively, you can opt to use the shell by passing shell=True as > an argument. Except that the OP is talking about a directory passed

RE: subprocess question

2011-12-12 Thread jyoung79
> import subprocess > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', >> stdout=subprocess.PIPE) > out, err = p.communicate() > out >> ' 11M\t.\n' > You might prefer to use subprocess.check_output(); it slightly > simplifies your code: > http://docs.python.or

Re: subprocess question

2011-12-11 Thread Chris Rebert
On Sun, Dec 11, 2011 at 8:39 PM, wrote: > Wondering if anyone could shed some light on the subprocess module?  I'll > admit I'm not that great at the shell. > > If I was wanting to get the size of the trash (on OS X), I could use: > os.system('du -sh ~/.Trash/') >  11M    /Users/jay/.Trash/

Re: subprocess question

2011-12-11 Thread Andrew Berg
On 12/11/2011 10:39 PM, jyoun...@kc.rr.com wrote: > And another question - why can't I use the tilde as a shortcut to the home > directory? Because subprocess doesn't use the shell (which is what expands the tilde to the invoking user's home directory). I recommend using os.path.join and os.enviro

subprocess question

2011-12-11 Thread jyoung79
Wondering if anyone could shed some light on the subprocess module? I'll admit I'm not that great at the shell. If I was wanting to get the size of the trash (on OS X), I could use: >>> os.system('du -sh ~/.Trash/') 11M/Users/jay/.Trash/ 0 Which gives me what I want. However, I've been r

Re: Newbie subprocess question

2010-11-26 Thread News123
On 11/26/2010 12:18 AM, Tim Harig wrote: > On 2010-11-25, Hugo Léveillé wrote: >> I'm starting various application using subprocess.Popen without any >> problem. The problem is with application inside "Program Files". It >> looks like subprocess is stopping the application string after >> "Program

Re: Newbie subprocess question

2010-11-25 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Hugo Léveillé wrote: I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside

Re: Newbie subprocess question

2010-11-25 Thread MRAB
On 25/11/2010 22:56, Hugo Léveillé wrote: I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside doubl

Re: Newbie subprocess question

2010-11-25 Thread Tim Harig
On 2010-11-25, Hugo Léveillé wrote: > I'm starting various application using subprocess.Popen without any > problem. The problem is with application inside "Program Files". It > looks like subprocess is stopping the application string after > "Program". I tried puting the programe name inside doub

Newbie subprocess question

2010-11-25 Thread Hugo Léveillé
I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside double quote like '"Program File*..."'. No luck.

Re: Python subprocess question

2009-01-06 Thread Roger
On Jan 6, 1:18 pm, s...@pobox.com wrote: >     Roger> .setDaemon(True) means the thread gets destroyed when the program >     Roger> exits and default .setDaemon(False) means that the thread >     Roger> continues to process even when the main program is gone? > > Approximately.  The main thread (a

Re: Python subprocess question

2009-01-06 Thread skip
Roger> .setDaemon(True) means the thread gets destroyed when the program Roger> exits and default .setDaemon(False) means that the thread Roger> continues to process even when the main program is gone? Approximately. The main thread (and thus the program) will exit only when all non-

Re: Python subprocess question

2009-01-06 Thread Roger
On Jan 6, 7:46 am, Duncan Booth wrote: > "Alexi Zuo" wrote: > > Hi everyone, > > > Here I have a simple program which starts a thread and the thread use > > Popen to execute a shell cmd which needs a long time.  I want to stop > > the thread once I type "ctrl+C" (KeyboardInterrupt). But in fact t

Re: Python subprocess question

2009-01-06 Thread Duncan Booth
"Alexi Zuo" wrote: > Hi everyone, > > Here I have a simple program which starts a thread and the thread use > Popen to execute a shell cmd which needs a long time. I want to stop > the thread once I type "ctrl+C" (KeyboardInterrupt). But in fact this > program enters a dead loop. Can anyone tel

Python subprocess question

2009-01-06 Thread Alexi Zuo
Hi everyone, Here I have a simple program which starts a thread and the thread use Popen to execute a shell cmd which needs a long time. I want to stop the thread once I type "ctrl+C" (KeyboardInterrupt). But in fact this program enters a dead loop. Can anyone tell me what is wrong? Alex from s

Re: Terminating a subprocess question

2006-03-30 Thread Ernesto
Ernesto wrote: > I'm opening a telnet session with the subprocess call below. I then > wait ten seconds and attempt to terminate the telnet window I created. > Unfortuantely, the telnet window remains after the 'TerminateProcess" > call below. This software works great for opening an executable

Re: Terminating a subprocess question

2006-03-29 Thread Fredrik Lundh
Ernesto wrote: > > > tn = telnetlib.Telnet("localhost",6000) > > > print tn.read_all() > > > # CRASH > > > > that's an unusual error message. are you sure you didn't get a > > traceback? if so, what did it say? > > I was running it directly in a python shell. After the tn.read_all() > call, the

Re: Terminating a subprocess question

2006-03-29 Thread Ernesto
Fredrik Lundh wrote: > Ernesto wrote: > > > Plus, everytime, I tried to use the read_all object, my program crashed > > pretty hard... > > > > tn = telnetlib.Telnet("localhost",6000) > > print tn.read_all() > > # CRASH > > that's an unusual error message. are you sure you didn't get a > traceback

Re: Terminating a subprocess question

2006-03-29 Thread Fredrik Lundh
Ernesto wrote: > Plus, everytime, I tried to use the read_all object, my program crashed > pretty hard... > > tn = telnetlib.Telnet("localhost",6000) > print tn.read_all() > # CRASH that's an unusual error message. are you sure you didn't get a traceback? if so, what did it say? -- http:/

Re: Terminating a subprocess question

2006-03-29 Thread Ernesto
Diez B. Roggisch wrote: > Ernesto wrote: > > > I'm opening a telnet session with the subprocess call below. I then > > wait ten seconds and attempt to terminate the telnet window I created. > > Unfortuantely, the telnet window remains after the 'TerminateProcess" > > call below. This software wo

Re: Terminating a subprocess question

2006-03-29 Thread Diez B. Roggisch
Ernesto wrote: > I'm opening a telnet session with the subprocess call below. I then > wait ten seconds and attempt to terminate the telnet window I created. > Unfortuantely, the telnet window remains after the 'TerminateProcess" > call below. This software works great for opening an executable

Terminating a subprocess question

2006-03-29 Thread Ernesto
I'm opening a telnet session with the subprocess call below. I then wait ten seconds and attempt to terminate the telnet window I created. Unfortuantely, the telnet window remains after the 'TerminateProcess" call below. This software works great for opening an executable directly (i.e. Handle =