Program return value ?

George Marshall g.marshall at nospam.com
Fri Jan 9 16:49:26 CET 2004


Hi all, I'm trying to get the exit code of a program
I want to exec in a python script in a portable manner.

I've read that both os.system and os.spawnl are not a
portable solution.

I tried the os.popen() function and I got the program's exit
code with the close() method.

p=os.popen("return_a_exit_code.sh")
retval=p.close()

The only problem is that it doesn't return negative values.

What is your experience with that ?

Thanks in advance.




More information about the Python-list mailing list