Bug 461419 - Improve behavior of "pydoc -k" in the face of broken modules
Summary: Improve behavior of "pydoc -k" in the face of broken modules
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python
Version: 12
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Dave Malcolm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 447779 561419 594686 596370 639125 649707 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-07 19:04 UTC by Carl Hartman
Modified: 2018-04-11 11:52 UTC (History)
9 users (show)

Fixed In Version: python-2.6.5-12.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-05-27 15:39:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Carl Hartman 2008-09-07 19:04:12 UTC
Description of problem:
Upon using pydoc -k 'different strings' i get what is below:
$ pydoc -k string
docstrings - Module documentation
StringIO - File-like objects that read from or write to a string buffer.
UserString - A user-defined wrapper around string objects
distutils.versionpredicate - Module for parsing and testing package version predicate strings.
doctest - Module doctest -- a framework for running examples in docstrings.
encodings.string_escape - Python 'escape' Codec
string - A collection of string operations (most are no longer used).
stringold - Common string manipulations.
stringprep - Library that exposes various tables found in the StringPrep RFC 3454.
cStringIO 
OpenGL.GL.GREMEDY.string_marker 
Traceback (most recent call last):
  File "/usr/bin/pydoc", line 5, in <module>
    pydoc.cli()
  File "/usr/lib/python2.5/pydoc.py", line 2189, in cli
    apropos(val)
  File "/usr/lib/python2.5/pydoc.py", line 1887, in apropos
    ModuleScanner().run(callback, key)
  File "/usr/lib/python2.5/pydoc.py", line 1852, in run
    for importer, modname, ispkg in pkgutil.walk_packages():
  File "/usr/lib/python2.5/pkgutil.py", line 125, in walk_packages
    for item in walk_packages(path, name+'.', onerror):
  File "/usr/lib/python2.5/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/usr/lib/python2.5/site-packages/OpenGL/WGL/__init__.py", line 3, in <module>
    wglUseFontBitmaps = wglUseFontBitmapsW
NameError: name 'wglUseFontBitmapsW' is not defined



Version-Release number of selected component (if applicable):
Python 2.5.1

How reproducible:
Easily, everytime i do use pydoc -k 'anything' results in the same thing

Steps to Reproduce:
1.pydoc -k 'anything'
2.
3.
  
Actual results:
The above explains it well enough I think.

Expected results:


Additional info:

Comment 1 Bug Zapper 2009-06-10 02:38:57 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Bug Zapper 2009-07-14 14:12:36 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Nils Philippsen 2009-11-27 10:58:07 UTC
Reopening this because pydoc still doesn't gracefully handle offensive modules, i.e. those that insist on doing stuff when imported, which fails in some situations:

--- 8< ----------
nils@gibraltar:~> rpm -q python
python-2.6.2-2.fc12.x86_64
nils@gibraltar:~> pydoc -k string
StringIO - File-like objects that read from or write to a string buffer.
UserString - A user-defined wrapper around string objects
[...]
dm.c: 1640: not running as root returning empty list
[...]
(process:6997): Gdk-CRITICAL **: gdk_keymap_get_for_display: assertion `GDK_IS_DISPLAY (display)' failed

(process:6997): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

** (process:6997): CRITICAL **: egg_keymap_resolve_virtual_modifiers: assertion `GDK_IS_KEYMAP (keymap)' failed
[...]
gtcache.gettext: not initialized for string "Ok"
gtcache.gettext: not initialized for string "Close"
gtcache.gettext: not initialized for string "Cancel"
[...]
Traceback (most recent call last):
  File "/usr/bin/pydoc", line 5, in <module>
    pydoc.cli()
  File "/usr/lib64/python2.6/pydoc.py", line 2264, in cli
    apropos(val)
  File "/usr/lib64/python2.6/pydoc.py", line 1962, in apropos
    ModuleScanner().run(callback, key)
  File "/usr/lib64/python2.6/pydoc.py", line 1927, in run
    for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
  File "/usr/lib64/python2.6/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/usr/lib64/python2.6/site-packages/parted/__init__.py", line 28, in <module>
    from _ped import AlignmentException
RuntimeError: pyparted requires root access
-- >8 ----------

Running "pydoc -k" should catch all exceptions while importing modules, and display failed modules _after_ all positive keyword matches (not in between). It also should redirect stdout/stderr while importing so error message e.a. don't clutter up the list of hits.

Comment 4 Dave Malcolm 2009-12-02 20:52:42 UTC
Renaming from:
  "pydoc -k" yields "NameError: name 'wglUseFontBitmapsW' is not 
defined"
so that this bug can be a more general bug about improving the robustness of "pydoc -k" in the face of broken modules.
  

I've filed this issue in the upstream tracker here:
http://bugs.python.org/issue7425
with a first pass at a patch.

Comment 5 Dave Malcolm 2009-12-02 20:53:18 UTC
*** Bug 447779 has been marked as a duplicate of this bug. ***

Comment 7 Dave Malcolm 2010-02-06 16:03:54 UTC
*** Bug 561419 has been marked as a duplicate of this bug. ***

Comment 8 Dave Malcolm 2010-05-21 13:16:29 UTC
*** Bug 594686 has been marked as a duplicate of this bug. ***

Comment 9 Dave Malcolm 2010-05-27 15:26:31 UTC
*** Bug 596370 has been marked as a duplicate of this bug. ***

Comment 10 Dave Malcolm 2010-05-27 15:39:18 UTC
Adding my workaround; building into rawhide as python-2.6.5-12.fc14

Comment 11 Jeff Moyer 2010-05-27 16:43:21 UTC
I'm confused.  The upstream bug tracker comments seemed positive.  Is this not going in upstream?

Comment 12 Dave Malcolm 2010-05-27 17:18:12 UTC
(In reply to comment #11)
> I'm confused.  The upstream bug tracker comments seemed positive.  Is this not
> going in upstream?
Upstream patch review can take a while, alas.  Given that the patch is trivial and that this issue is continuing to affect people and generate bug reports, I feel applying the patch downstream is appropriate.

Comment 13 Dave Malcolm 2010-09-30 21:36:05 UTC
*** Bug 639125 has been marked as a duplicate of this bug. ***

Comment 14 Dave Malcolm 2010-11-04 15:07:14 UTC
*** Bug 649707 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.