Is subprocess.Popen completely broken?

Guilherme Polo ggpolo at gmail.com
Thu Mar 27 10:58:36 EDT 2008


2008/3/27, Skip Montanaro <skip at pobox.com>:
> I am trying to replace os.system calls with subprocess.Popen.  This simple
>  example fails miserably:
>
>  >>> proc = subprocess.Popen ("ls /tmp")

proc = subprocess.Popen ("ls /tmp", shell=True)

or

proc = subprocess.Popen (["ls", "/tmp"])

should work.

>  Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/titan/skipm/local/lib/python2.5/subprocess.py", line 594, in __init__
>     errread, errwrite)
>   File "/home/titan/skipm/local/lib/python2.5/subprocess.py", line 1091, in
>  _execute_child
>     raise child_exception
>  OSError: [Errno 2] No such file or directory
>
>  I also tried explicitly referencing /usr/bin/ls.  Same result.  What gives?
>  I see this behavior in both Python 2.4 and 2.5 on Solaris 10 and with
>  2.6alpha on Mac OS X.
>
>  Frustrated in Chicago...
>
>  Skip
>
>
>
>  --
>  http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list