[Tutor] Runing an external command?
Magnus Lycka
magnus@thinkware.se
Thu, 10 Oct 2002 22:14:05 +0200
At 15:02 2002-10-10 +0100, James.Rocks@equant.com wrote:
>So my question is how do I run an external program and does the program
>wait until that program has finished execution or does it just carry on
>regardless?
host =3D 'www.python.org'
os.system('ping %s" % host)
Will wait for the ping to finish.
Obviously, if you want the output, your program
must wait:
resultList =3D os.popen('ping %s' % host).readlines()
If you don't want your program to wait, you should
run the following.
Windows: os.system('start ping %s" % host)
Unix: os.system('ping %s &" % host)
--=20
Magnus Lyck=E5, Thinkware AB
=C4lvans v=E4g 99, SE-907 50 UME=C5
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se