os.system()
Nick Craig-Wood
nick at craig-wood.com
Mon Mar 7 09:30:02 EST 2005
Joerg Schuster <joerg.schuster.REMOVETHIS at gmail.com> wrote:
> os.system(command)
>
> only works for some values of 'command' on my system (Linux). A certain
> shell command (that *does* run on the command line) does not work when
> called with os.system(). Does anyone know a simple and stable way to
> have *any* string executed by the shell?
The command is exectued through the shell, eg
>>> os.system("sleep 60 > z")
$ ps axf
5121 ? S 0:00 rxvt
5123 pts/77 Ss 0:00 \_ bash
5126 pts/77 S+ 0:00 \_ python
5149 pts/77 S+ 0:00 \_ sh -c sleep 60 > z
5150 pts/77 S+ 0:00 \_ sleep 60
Things to check
1) quoting, python vs shell
2) PATH - check PATH is set the same in shell / python
3) check the whole of the environment
Also if you are using 2.4 check the subprocess module
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list