[python-win32] does pipes.quote() work properly on Windows?

Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 23 03:00:18 CEST 2010


Bill Janssen wrote:

>    myprogram --title="That's the game! says Mike "Hammer" Brotsky" --file=...

> Since
> cmd.exe also supports pipelines, I'd sort of expect it to do the right
> thing on Windows, too.

Don't know about later versions, but in Python 2.5 the pipes
module is listed under "Unix specific services", so I guess
it was never designed with Windows in mind.

The reason it fails on Windows is that it assumes single
quotes can be used to quote a string containing double
quotes. But Windows usually requires double quotes around
arguments, so you will have to escape the inner quotes:

--title="That's the game! says Mike \"Hammer\" Brotsky"

A quick test suggests that this will work, at least in the
case where the program being passed the args is a Python
program.

-- 
Greg


More information about the python-win32 mailing list