Problem with py2exe-frozen CGIHttpServer-based script

Will Stuyvesant hwlgw at hotmail.com
Thu Nov 27 08:17:51 EST 2003


Look at this piece of code in my *modified* CGIHTTPServer.py:

            if self.is_python(scriptfile):
                # THIS DOESN'T WORK AFTER PY2EXE!
                #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)
                cmdline = "%s -u %s" % ('distpython', cmdline)

The comments have the "original" standard library code.  It uses
sys.executable, and that returns "yourCGIProg.exe" instead of
"Python.exe" or something like that, as you need for running the CGI
program.

My *modified* version works when used by some *.exe generated by
py2exe.

-- 
Man is the only animal that blushes -- or needs to.
                -- Mark Twain




More information about the Python-list mailing list