classification
Title: subprocess.Popen with wildcard arguments
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: pbrandt, skip.montanaro
Priority: normal Keywords:

Created on 2008-03-20 20:38 by pbrandt, last changed 2008-03-21 01:10 by skip.montanaro. This issue is now closed.

Messages (2)
msg64204 - (view) Author: Patrick (pbrandt) Date: 2008-03-20 20:38
When using wildcards as arguments to the processes being spawned by
Popen, it seems to interpret them as hard literals.

IE, when doing something like:
>>> import subprocess
>>> output = subprocess.Popen(['ls', '*'],
stdout=subprocess.PIPE).communicate()[0]
ls: *: No such file or directory
>>>
msg64228 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-03-21 01:10
The default for Popen objects is to not use the shell, thus
no expansion.  Set shell=True in the Popen call:

>>> import subprocess
>>> output = subprocess.Popen(['ls', '*'])
>>> ls: *: No such file or directory

>>> output = subprocess.Popen(['ls', '*'], shell=True)
>>> configure.out	svn-stat.out	svn-update.out

Skip
History
Date User Action Args
2008-03-21 01:10:54skip.montanarosetstatus: open -> closed
resolution: works for me
messages: + msg64228
nosy: + skip.montanaro
2008-03-20 20:38:31pbrandtcreate