[Python-Dev] test_popen broken on Win2K (original) (raw)
Kevin Altis altis@semi-retired.com
Fri, 7 Mar 2003 14:31:21 -0800
- Previous message: [Python-Dev] test_popen broken on Win2K
- Next message: [Python-Dev] test_popen broken on Win2K
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: Thomas Heller
Tim Peters <tim.one@comcast.net> writes: > Someone changed testpopen to "quote" the path to python: > > cmd = '"%s" -c "import sys;print sys.argv" %s' % (sys.executable, > cmdline) > ^ ^ > > The double-quote characters above the carets are new. > > This causes testpopen to fail on Win2K, but not on Win98. The relevant > difference appears to be the default shell (cmd.exe on the former, > command.com on the latter). In distutils we had a similar problem. I don't remember the details at the moment exactly, but I think enclosing sys.executable in double quotes only when it contains spaces should do the trick.
My example isn't for popen, but this sounds familiar. There are a few places where I had to do things like this for some Win98 folks that installed 'Python22' into 'C:\Program Files' instead of at 'C:'
if ' ' in sys.executable:
python = '"' + sys.executable + '"'
else:
python = sys.executable
os.spawnv(os.P_NOWAIT, python, [python, filename])
there have also been some quote issues with the arguments like filename and I'm still not sure all the cases on various versions of Windows, Mac OS X, and Linux work correctly all the time.
David Ascher is on vacation, otherwise he could tell us all about the process.py module and how it relates to these issues :)
ka
- Previous message: [Python-Dev] test_popen broken on Win2K
- Next message: [Python-Dev] test_popen broken on Win2K
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]