popen[2-4] does not work with parameters inside quotes

Emile van Sebille emile at fenx.com
Fri Oct 31 11:29:21 EST 2003


"Anders Dalvander" <google at dalvander.com> wrote in message
news:d04c84a9.0310310529.6b160e57 at posting.google.com...
> "Emile van Sebille" <emile at fenx.com> wrote in message
news:<bnrte4$14vkmn$1 at ID-11957.news.uni-berlin.de>...
> > Hmm... not for me... I get:
> >
> > >>> import os
> > >>> cmd = '"c:\\command.exe" "parameter inside quotes"'
> > >>> os.popen4(cmd)
> > (<open file '"c:\command.exe" "parameter inside quotes"', mode 'w' at
> > 0x008E6620>, <open file '"c:\command.exe" "parameter insid
> > e quotes"', mode 'r' at 0x008EC060>)
> >
>
> Did you try with having the exe-file in another directory with spaces:
> "c:\path with spaces\command.exe"?

This wraps, but here's the result:

Python 2.4a0 (#46, Oct 25 2003, 09:39:59) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> cmd = '"C:\\Program Files\\Microsoft Visual
Studio\\Common\\Tools\\dfview.ex
e" "parameter inside quotes"'
>>> os.popen4(cmd)
(<open file '"C:\Program Files\Microsoft Visual
Studio\Common\Tools\dfview.exe"
"parameter inside quotes"', mode 'w' at 0x008E4EE0>, <open file '"C:\Program
Fil
es\Microsoft Visual Studio\Common\Tools\dfview.exe" "parameter inside
quotes"',
mode 'r' at 0x008EC660>)
>>>

>
> What Windows version are you running?
>
This was on winxppro.

Emile






More information about the Python-list mailing list