catching java program return

eight02645999 at yahoo.com eight02645999 at yahoo.com
Tue Mar 14 07:36:53 CET 2006


hi

i have to run a java program inside my python script.
i have some java classes declared:
os.environ['CLASSPATH'] = "blah path"

then i used the os.system method to invoke the java program and using
ret = os.WEXITSTATUS(os.system(cmd)) to catch the return

Java gave me an error about unable to locate some classes,  and the ret
value is 0. Why is this so? thanks
can anyone advise also on how can i properly catch the correct Java
generated exceptions in the above case. I was thinking i could use
subprocess module, is there a good example of using this module instead
of using os.system? or are they both achieve the same results?

thanks very much for your help.




More information about the Python-list mailing list