This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients loewis, orsenthil, v+python
Date 2010-11-23.09:51:52
SpamBayes Score 1.8842037e-07
Marked as misclassified No
Message-id <1290505914.43.0.597315955076.issue10483@psf.upfronthosting.co.za>
In-reply-to
Content
Martin, you are splitting hairs about the "reported problem".  The original message does have a paragraph about the executable bits being wrong.  But the bulk of the message is commenting about the difficulty of figuring out what to replace it with.

So it looks like in spite of the hair splitting, we have iterated to a design of making run_cgi a bit friendlier in this regard.

I find it sufficient to define a method fully extracted from run_cgi as follows:

    def make_cmdline( self, scriptfile, query ):
        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 = [interp, '-u'] + cmdline
        if '=' not in query:
            cmdline.append(query)

This leaves run_cgi with:

            import subprocess
            cmdline = self.make_cmdline( scriptfile, query )
            self.log_message("command: %s", subprocess.list2cmdline(cmdline))


Apologies: I don't know what format of patch is acceptable, but this is a simple cut-n-paste change.  I was sort of holding off until the hg conversion to figure out how to make code submissions, since otherwise I'd have to learn it twice in short order.

I have reimplemented my work-arounds in terms of the above fix, and they function correctly, so this fix would suffice for me, for this issue.  (N.B. I'm sure you've noticed that I have entered a number of issues for http.server; I hope that was the right way to do it, to attempt to separate the issues.)
History
Date User Action Args
2010-11-23 09:51:54v+pythonsetrecipients: + v+python, loewis, orsenthil
2010-11-23 09:51:54v+pythonsetmessageid: <1290505914.43.0.597315955076.issue10483@psf.upfronthosting.co.za>
2010-11-23 09:51:52v+pythonlinkissue10483 messages
2010-11-23 09:51:52v+pythoncreate