Message143502
Pydoc is failing when running the ModuleScanner().run() when you execute:
help("modules keyword")
... if some module throws an exception at the import time.
See this example:
>>> help("modules convolve")
Here is a list of matching modules. Enter any module name to get more help.
numpy.numarray.convolve
scipy.fftpack.convolve
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site.py", line 467, in __call__
return pydoc.help(*args, **kwds)
File "C:\Python27\lib\pydoc.py", line 1727, in __call__
self.help(request)
File "C:\Python27\lib\pydoc.py", line 1768, in help
self.listmodules(split(request)[1])
File "C:\Python27\lib\pydoc.py", line 1873, in listmodules
apropos(key)
File "C:\Python27\lib\pydoc.py", line 1975, in apropos
ModuleScanner().run(callback, key)
File "C:\Python27\lib\pydoc.py", line 1938, in run
for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
File "C:\Python27\lib\pkgutil.py", line 125, in walk_packages
for item in walk_packages(path, name+'.', onerror):
File "C:\Python27\lib\pkgutil.py", line 125, in walk_packages
for item in walk_packages(path, name+'.', onerror):
File "C:\Python27\lib\pkgutil.py", line 125, in walk_packages
for item in walk_packages(path, name+'.', onerror):
File "C:\Python27\lib\pkgutil.py", line 125, in walk_packages
for item in walk_packages(path, name+'.', onerror):
File "C:\Python27\lib\pkgutil.py", line 110, in walk_packages
__import__(name)
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\lib\pubsub\core\arg1\__init__.py", line 16, in <module>
raise RuntimeError(msg)
RuntimeError: Should not import this directly, used by pubsub.core if applicable
After suppressing the exception by changing the "apropos()" method inside the pydoc.py:
Line:
ModuleScanner().run(callback, key)
To:
ModuleScanner().run(callback, key, onerror=lambda error: error)
The problem is fixed, but I really don't know if this is the best way to suppress this and if we should suppress these exceptions, I think that as the intent of the help("modules keyword") is to find things with the keyword in the name, we shouldn't let the exception be propagated to the user. |
|
Date |
User |
Action |
Args |
2011-09-05 01:15:58 | Christian.S..Perone | set | recipients:
+ Christian.S..Perone |
2011-09-05 01:15:57 | Christian.S..Perone | set | messageid: <1315185357.98.0.244247068278.issue12894@psf.upfronthosting.co.za> |
2011-09-05 01:15:57 | Christian.S..Perone | link | issue12894 messages |
2011-09-05 01:15:55 | Christian.S..Perone | create | |
|