From: Brian Z. <bz...@ig...> - 2001-03-19 22:39:36
|
Here's an extremely simple example (by no means production, but could get you on your way): """ Process the command. """ from java.lang import Runtime from java.io import BufferedInputStream p =3D Runtime.getRuntime().exec("ls") #p.waitFor() stream =3D BufferedInputStream(p.getInputStream()) e =3D [] r =3D stream.read() while r !=3D -1: e.append(r) r =3D stream.read() print "".join(map(chr, e)) Running it produces: D:\home\development\python>jython process.py HTTPSession$py.class HTTPSession.py __init__.py a5.py aar.py acl.py aioobe.py ant.py atl.py caps.py cont.py brian -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of John E. Conlon Sent: Monday, March 19, 2001 4:22 PM To: jyt...@li... Subject: [Jython-users] How to call external commands Hi Jython users, I would like to replace my bat and sh startup scripts with jython py scripts. But after experimentation I can not figure out how to call external executables in my underlying system. =20 Have seen comments that the os.system(name) command is not yet implemented. Is there any other way to launch external programs without the os.system command? thanks for any suggestions, John _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |