[New-bugs-announce] [issue3133] CGIHTTPRequestHandler does not work on windows

Amaury Forgeot d'Arc report at bugs.python.org
Wed Jun 18 11:28:32 CEST 2008


New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:

On windows, test_httpservers fails with the error:

  File "C:\python\py3k\Lib\http\server.py", line 1104, in run_cgi
    exec(open(scriptfile).read(), {"__name__": "__main__"})
  File "<string>", line 3, in <module>
  File "C:\python\py3k\Lib\socket.py", line 222, in write
    return self._sock.send(b)
  TypeError: send() argument 1 must be bytes or read-only buffer, not str

There are two problems there:
- Lib/http/server.py still looks for os.popen2 or os.popen3 to start a
subprocess; these functions have been removed, this code should be
rewritten using the subprocess module.
- the fallback method, which exec() the cgi script in the python
interpreter, fails because sys.stdout should be set to a TextIOWrapper,
not a binary socket file.

Certainly the fallback method could be removed: every platform
implements subprocess nowadays.

----------
components: Library (Lib), Windows
messages: 68361
nosy: amaury.forgeotdarc
severity: normal
status: open
title: CGIHTTPRequestHandler does not work on windows
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3133>
_______________________________________


More information about the New-bugs-announce mailing list