[Tutor] os.system() with NO_WAIT

János Juhász janos.juhasz at VELUX.com
Tue Aug 8 10:22:55 CEST 2006


Thanks Wesley,

 I lokked for subprocess.Popen.

os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg") was to complicated 
for me based on the manual.


Yours sincerely, 
______________________________
János Juhász 
VELUX Magyarország Fertődi Építőkomponens Kft. 
IT Department
Malom Köz 1, H-9431 Fertőd 
Telephone direct:      +36 99 537 939
Telephone office:      +36 99 537 920
Office fax:                +36 99 537 921
Telephone mobile:    +36 30 682 6331
@                             janos.juhasz at VELUX.com
www                        www.VELUX.com




"wesley chun" <wescpy at gmail.com> 

2006.08.07 22:28

To
"János Juhász" <janos.juhasz at velux.com>
cc
tutor at python.org
Subject
Re: [Tutor] os.system() with NO_WAIT



>         os.system('vedicom.exe')
>
> Have you got any idea how I can strart this windows GUI program with not
> waiting its return.

instead of os.system(), you want to use the subprocess module if you
are using Python 2.4+:
http://docs.python.org/lib/module-subprocess.html

calling subprocess.Popen(["/bin/mycmd", "myarg"]) is "no wait."

to save the PID:

pid = subprocess.Popen(["/bin/mycmd", "myarg"]).pid

if you are using Python 2.3.x and older, you have to use spawn*():

pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060808/a7461a4b/attachment.html 


More information about the Tutor mailing list