summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorKa-Ping Yee <ping@zesty.ca>2008-01-13 11:25:13 (GMT)
committerKa-Ping Yee <ping@zesty.ca>2008-01-13 11:25:13 (GMT)
commit9e0f116fac93be51b78551e96d9cd8b4e94b369d (patch)
treef975d1fca4bca5d6c47a96846b0ebc9f71989311 /Lib/pydoc.py
parent5f0b7ae481b327954273cd535c77ce1a22173345 (diff)
downloadcpython-9e0f116fac93be51b78551e96d9cd8b4e94b369d.zip
cpython-9e0f116fac93be51b78551e96d9cd8b4e94b369d.tar.gz
cpython-9e0f116fac93be51b78551e96d9cd8b4e94b369d.tar.bz2
Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries. Tested with Python build: trunk:54235:59936M -- the reported error occurs with Django installed (or with any __init__.py present on the path that raises an exception), and such errors indeed go away when this change is applied.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index f69f733..2d32316 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1816,7 +1816,9 @@ Please wait a moment while I gather a list of all available modules...
modname = modname[:-9] + ' (package)'
if find(modname, '.') < 0:
modules[modname] = 1
- ModuleScanner().run(callback)
+ def onerror(modname):
+ callback(None, modname, None)
+ ModuleScanner().run(callback, onerror=onerror)
self.list(modules.keys())
self.output.write('''
Enter any module name to get more help. Or, type "modules spam" to search
@@ -1852,7 +1854,7 @@ class Scanner:
class ModuleScanner:
"""An interruptible scanner that searches module synopses."""
- def run(self, callback, key=None, completer=None):
+ def run(self, callback, key=None, completer=None, onerror=None):
if key: key = lower(key)
self.quit = False
seen = {}
@@ -1867,7 +1869,7 @@ class ModuleScanner:
if find(lower(modname + ' - ' + desc), key) >= 0:
callback(None, modname, desc)
- for importer, modname, ispkg in pkgutil.walk_packages():
+ for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
if self.quit:
break
if key is None: