Is subprocess.Popen completely broken?
Gary Herron
gherron at islandtraining.com
Thu Mar 27 11:48:31 EDT 2008
Skip Montanaro wrote:
>>> >>> 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"])
>>>>
This line fails because of a typo. There needs to be a comma between
the two list elements. Without the comma, this becomes
proc = subprocess.Popen (["/usr/bin/ls/tmp"])
which obviously fails.
Gary Herron
> 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