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.

classification
Title: pydoc -k throws "AssertionError: distutils has already been patched by "
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Improve the robustness of "pydoc -k" in the face of broken modules
View: 7425
Assigned To: Nosy List: __KFL__, ned.deily, pitrou
Priority: normal Keywords:

Created on 2012-01-26 19:34 by __KFL__, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg152027 - (view) Author: __KFL__ (__KFL__) Date: 2012-01-26 19:34
Pydoc fails on the following exception. There is a mail discussing it: http://mail.python.org/pipermail/python-list/2009-December/1230790.html

C:\Python27\Lib>pydoc -k file
...
...
Traceback (most recent call last):
  File "C:\Python27\Lib\pydoc.py", line 2338, in <module>
    if __name__ == '__main__': cli()
  File "C:\Python27\Lib\pydoc.py", line 2277, in cli
    apropos(val)
  File "C:\Python27\Lib\pydoc.py", line 1974, in apropos
    ModuleScanner().run(callback, key)
  File "C:\Python27\Lib\pydoc.py", line 1939, in run
    for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
  File "C:\Python27\Lib\pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "C:\Python27\lib\site-packages\pypm\__init__.py", line 22, in <module>
    import setuptools
  File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "C:\Python27\lib\site-packages\setuptools\extension.py", line 2, in <module>
    from setuptools.dist import _get_unpatched
  File "C:\Python27\lib\site-packages\setuptools\dist.py", line 28, in <module>
    _Distribution = _get_unpatched(_Distribution)
  File "C:\Python27\lib\site-packages\setuptools\dist.py", line 24, in _get_unpatched
    "distutils has already been patched by %r" % cls
AssertionError: distutils has already been patched by <class py2exe.Distribution at 0x0000000005987408>
msg152081 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-01-27 10:24
For the record, the proposed solution in that e-mail is the following:

"B) Patch the run() method of pydoc module at line 1862:

for importer, modname, ispkg in 
	pkgutil.walk_packages(onerror=lambda s:None):"
msg152630 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-04 16:09
I believe this problem has been fixed by the changes for Issue7425 which will be released in the next updates of Python 2.7 (2.7.3) and 3 (3.2.3).
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58088
2012-02-04 16:09:55ned.deilysetstatus: open -> closed

superseder: Improve the robustness of "pydoc -k" in the face of broken modules

nosy: + ned.deily
messages: + msg152630
resolution: duplicate
stage: resolved
2012-01-27 10:24:37pitrousetversions: + Python 3.2, Python 3.3
nosy: + pitrou

messages: + msg152081

components: + Library (Lib)
type: crash -> behavior
2012-01-26 19:34:28__KFL__create