2008/3/27, Skip Montanaro <[EMAIL PROTECTED]>:
> 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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to