Re: [Tutor] os.system() with NO_WAIT

2006-08-08 Thread János Juhász

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
@  
[EMAIL PROTECTED]
www  
 www.VELUX.com






wesley chun [EMAIL PROTECTED]


2006.08.07 22:28



To
János Juhász
[EMAIL PROTECTED]

cc
tutor@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
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] os.system() with NO_WAIT

2006-08-07 Thread János Juhász

Dear Guys,

I have a small script that is running on a terminal
server's client session.

###
import os
import time
import glob

def send():
  print 'I am checking %s' % time.ctime()
  if len(glob.glob(r'U:\ediout\DESADV\*.doc'))
 0:
os.system('vedicom.exe')

if __name__ == '__main__':
  os.chdir(r'U:\vedicom\DESADV\\')
  while 1:
send()
time.sleep(30)
###

As you can see, it is just start
a windows program from a folder, when there are files in that folder.
My problem comes when the network
connection is broken. In that case, this program wait a user interaction
to push a button.
When the connection come back,
it is just waiting to push the button and we are missing to send the EDI
documents.

Have you got any idea how I can
strart this windows GUI program with not waiting its return.




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
@  
[EMAIL PROTECTED]
www  
 www.VELUX.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor