Using wildcards with Popen in the Subprocess module

Fabio FZero fabio.fzero at gmail.com
Thu Mar 15 15:47:32 EDT 2007


You could use glob and expand the resulting list to astring manually,
but you have to make sure the command accepts the "command file1 file2
file3..." format.

FZero

On Mar 15, 4:04 pm, William Hudspeth <bhudsp... at edac.unm.edu> wrote:
> Hello,
>
> I am needing to pass an argument to the Popen function of the Subprocess
> module that includes a wildcard in the filename. It seems that Popen is
> not able to expand wildcards, and treats a filename that includes a
> wildcard as a literal.
>
> EX.
>
> var1="/path_to_files/filnames*.doc"
> result=Popen(["command",var1]).wait()
>
> Can anyone tell me how I can work around this problem?
>
> Thanks, Bill





More information about the Python-list mailing list