Can I popen a command with a spawnv alike interface?

Erno Kuusela erno-news at erno.iki.fi
Sun Feb 25 08:07:05 EST 2001


In article <d5va79.k5e.ln at 127.0.0.1>, gradha at iname.com writes:

| Is there a way I could use popen giving file names as arguments rather
| than all the command in a single string which will get it wrong due to
| spaces and such things in file names?

no, but popen2 seems to do that.

>>> r, w = popen2.popen2(['echo', '"', ';', '$foo'])      
>>> r.read()
'" ; $foo\012'

this feature doesn't seem to be documented though, and i can't
tell from looking at the code if it'll work on windows.

  -- erno



More information about the Python-list mailing list