homepage

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.

Author Christian.S..Perone
Recipients Christian.S..Perone
Date 2011年09月05日.01:15:55
SpamBayes Score 9.030987e-11
Marked as misclassified No
Message-id <1315185357.98.0.244247068278.issue12894@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011年09月05日 01:15:58Christian.S..Peronesetrecipients: + Christian.S..Perone
2011年09月05日 01:15:57Christian.S..Peronesetmessageid: <1315185357.98.0.244247068278.issue12894@psf.upfronthosting.co.za>
2011年09月05日 01:15:57Christian.S..Peronelinkissue12894 messages
2011年09月05日 01:15:55Christian.S..Peronecreate

AltStyle によって変換されたページ (->オリジナル) /