Is subprocess.Popen completely broken?

Skip Montanaro skip at pobox.com
Thu Mar 27 11:10:17 EDT 2008


> >  >>> proc = subprocess.Popen ("ls /tmp")
> 
> proc = subprocess.Popen ("ls /tmp", shell=True)
> 
> or
> 
> proc = subprocess.Popen (["ls", "/tmp"])
> 
> should work.

Why should I need to set shell=True?  I'm not globbing anything.  The
second case still fails:

>>> proc = subprocess.Popen (["/usr/bin/ls" "/tmp"])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/opt/app/g++lib6/python-2.4/lib/python2.4/subprocess.py", line 542, in
__init__
    errread, errwrite)
  File "/opt/app/g++lib6/python-2.4/lib/python2.4/subprocess.py", line 975, in
_execute_child
    raise child_exception
OSError: [Errno 20] Not a directory

Thx,

Skip





More information about the Python-list mailing list