subprocess and & (ampersand)

Tim Golden mail at timgolden.me.uk
Wed Jan 23 16:10:07 CET 2008


Ross Ridge wrote:
> Tim Golden  <mail at timgolden.me.uk> wrote:
>> but this doesn't:
>>
>> <c:/temp/firefox.bat>
>> "c:\Program Files\Mozilla Firefox\firefox.exe" "%*"
>> </c:/temp/firefox.bat>
>>
>> <code>
>> import subprocess
>>
>> cmd = [
>> r"c:\temp\firefox.bat",
>> "http://local.goodtoread.org/search?word=tim&cached=0"
>> ]
>> subprocess.Popen (cmd)
>>
>> </code>
> 
> You need to use double quotes both in the .BAT file and in the string
> you pass to subprocess.Popen().
> 
> 					Ross Ridge

In the context of my example above, could you just
say which bit you thing should be quoted and isn't?
(That sounds sarcastic, but isn't; I just want to
understand if I've missed something). If you simply
requote the second element in the cmd list
('"http:/....."') then the internal quotes are escaped
by some part of the mechanism and it still doesn't work.

TJG



More information about the Python-list mailing list