Problems with os.system

Michael Hoffman cam.ac.uk at mh391.invalid
Fri Sep 2 18:08:44 EDT 2005


alexLIGO wrote:
> I am trying to run a python script that executes several other programs
> on the bash (under linux) and reads some of the output of those
> programs. This works fine for a couple of os.system() calls, but then
> it does not work anymore. os.system() returns always -1, but when
> executing exactly the same program directly on the linux-bash it works!

Try to break this down to a minimal testcase and then post that.

Also, I usually use the subprocess module instead of os.system these days.

> How can I check the memory usage in my python
> script? Can I force python to execute the program on the bash?

If bash is your shell, then os.system will call the program through a 
bash subshell.
-- 
Michael Hoffman



More information about the Python-list mailing list