You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CGIHTTPRequestHandler does not work on windows #47383
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2008-06-18.22:20:24.657>created_at=<Date2008-06-18.09:28:31.013>labels= ['library', 'OS-windows']
title='CGIHTTPRequestHandler does not work on windows'updated_at=<Date2008-06-18.22:20:24.656>user='https://github.com/amauryfa'
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.
Activity
amauryfa commentedon Jun 18, 2008
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:
subprocess; these functions have been removed, this code should be
rewritten using the subprocess module.
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.
amauryfa commentedon Jun 18, 2008
The attached patch uses subprocess when fork is not available.
test_httpservers now passes on windows
amauryfa commentedon Jun 18, 2008
Committed change r64389.