Problems with os.system

jepler at unpythonic.net jepler at unpythonic.net
Fri Sep 2 23:15:55 EDT 2005


On Fri, Sep 02, 2005 at 01:45:42PM -0700, alexLIGO wrote:
> Can I force python to execute the program on the bash? What can
> I do?

os.system() is a wrapper on system(3), which invokes /bin/sh.

If you want to use a different shell, you can use
    os.spawnv(os.P_WAIT, '/bin/bash', ['bash', '-c', command])
or even avoid the use of a shell altogether:
    os.spawnvp(os.P_WAIT, 'myprogram', ['myprogram', '-arg1', 'arg2'])

Jeff

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050902/536e59e1/attachment.sig>


More information about the Python-list mailing list