classification
Title: pydoc in web server mode tails at initial request
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti, amaury.forgeotdarc, prologic
Priority: critical Keywords: needs review, patch

Created on 2008-10-01 06:24 by prologic, last changed 2009-07-05 06:49 by alexandre.vassalotti. This issue is now closed.

Files
File name Uploaded Description Edit
pkgutil.patch amaury.forgeotdarc, 2008-10-01 08:59
Messages (3)
msg74116 - (view) Author: James Mills (prologic) Date: 2008-10-01 06:24
Trying to use pydoc in it's webserver mode fails:

$ pydoc3.0 -p 8000
pydoc server ready at http://localhost:8000/
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 42939)
Traceback (most recent call last):
  File "/usr/lib/python3.0/socketserver.py", line 281, in
_handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.0/socketserver.py", line 307, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.0/socketserver.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.0/socketserver.py", line 614, in __init__
    self.handle()
  File "/usr/lib/python3.0/http/server.py", line 363, in handle
    self.handle_one_request()
  File "/usr/lib/python3.0/http/server.py", line 357, in handle_one_request
    method()
  File "/usr/lib/python3.0/pydoc.py", line 1957, in do_GET
    indices.append(html.index(dir, seen))
  File "/usr/lib/python3.0/pydoc.py", line 929, in index
    for importer, name, ispkg in pkgutil.iter_modules([dir]):
  File "/usr/lib/python3.0/pkgutil.py", line 147, in iter_modules
    for name, ispkg in iter_importer_modules(i, prefix):
  File "/usr/lib/python3.0/pkgutil.py", line 325, in iter_zipimport_modules
    dirlist.sort()
AttributeError: 'dict_keys' object has no attribute 'sort'
----------------------------------------
pydoc server stopped
msg74120 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-10-01 08:59
The problem occurs when sys.path contains the name of an existing zip file.

Here is a patch, with tests.
msg90144 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-07-05 06:49
Committed in r73856.
History
Date User Action Args
2009-07-05 06:49:04alexandre.vassalottisetstatus: open -> closed

nosy: + alexandre.vassalotti
messages: + msg90144

resolution: accepted
stage: resolved
2008-10-01 08:59:30amaury.forgeotdarcsetpriority: critical
keywords: + needs review, patch
messages: + msg74120
files: + pkgutil.patch
nosy: + amaury.forgeotdarc
2008-10-01 06:24:49prologiccreate