In module CGIHTTPServer.py, in the section containing
the following:
-----
elif self.have_popen2 or self.have_popen3:
# Windows -- use popen2 or popen3 to create a
subprocess
import shutil
if self.have_popen3:
popenx = os.popen3
else:
popenx = os.popen2
cmdline = scriptfile
if self.is_python(scriptfile):
interp = sys.executable
if interp.lower().endswith("w.exe"):
# On Windows, use python.exe, not
pythonw.exe
interp = interp[:-5] + interp[-4:]
cmdline = "%s -u %s" % (interp, cmdline)
-----
The final line, number 231 in my copy (version 0.4 in
Python 2.2.2), doesn't handle filespecs with embedded
spaces correctly. A script named, for example, "Powers
of two.py" won't be found. This can be fixed by changing
the quoting, namely to:
cmdline = '%s -u "%s"' % (interp, cmdline)
so that the script name in cmdline is quoted properly.
Note that embedded spaces in interp could also cause
problems (if Python were installed in C:\Program Files\
for example), but though adding "s around the first %s
works for commands executed directly within Windows
XP's cmd.exe, I couldn't get os.popen3 to handle them.
Thanks for your help.
Allan Wilson
|