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.

classification
Title: CGIHTTPRequestHandler does not work on windows
Type: Stage:
Components: Library (Lib), Windows Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc
Priority: normal Keywords: patch

Created on 2008-06-18 09:28 by amaury.forgeotdarc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
httpserver.patch amaury.forgeotdarc, 2008-06-18 12:54
Messages (3)
msg68361 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-18 09:28
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.
msg68362 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-18 12:53
The attached patch uses subprocess when fork is not available.
test_httpservers now passes on windows
msg68379 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-18 22:20
Committed change r64389.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47383
2008-06-18 22:20:24amaury.forgeotdarcsetstatus: open -> closed
resolution: fixed
messages: + msg68379
2008-06-18 12:54:21amaury.forgeotdarcsetkeywords: + patch
files: + httpserver.patch
messages: + msg68362
2008-06-18 09:28:31amaury.forgeotdarccreate