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: Getting call trace while executing "modules spam" at help prompt
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.6
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: eric.araujo, georg.brandl, jankratochvil, ned.deily, pitrou, r.david.murray, rishikesh
Priority: low Keywords: patch

Created on 2009-09-29 06:38 by rishikesh, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pkgutil.py.patch jankratochvil, 2009-09-30 12:38 pkgutil.py resistance against modules errors.
Messages (7)
msg93253 - (view) Author: Rishikesh K Rajak (rishikesh) Date: 2009-09-29 06:38
[root@ ~]# python
Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) 
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.6!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules spam

Here is a list of matching modules.  Enter any module name to get more help.


** (.:18352): WARNING **: Trying to register gtype 'WnckWindowState' as
flags when in fact it is of type 'GEnum'

** (.:18352): WARNING **: Trying to register gtype 'WnckWindowActions'
as flags when in fact it is of type 'GEnum'

** (.:18352): WARNING **: Trying to register gtype
'WnckWindowMoveResizeMask' as flags when in fact it is of type 'GEnum'
Adding pauses to default speech formatting strings.
Adding pauses to Gecko speech formatting strings.
Adding pauses to soffice speech formatting strings.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site.py", line 433, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib64/python2.6/pydoc.py", line 1720, in __call__
    self.interact()
  File "/usr/lib64/python2.6/pydoc.py", line 1738, in interact
    self.help(request)
  File "/usr/lib64/python2.6/pydoc.py", line 1757, in help
    self.listmodules(split(request)[1])
  File "/usr/lib64/python2.6/pydoc.py", line 1862, in listmodules
    apropos(key)
  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/lib/python2.6/site-packages/gdb/__init__.py", line 19, in
<module>
    import gdb.command.require
  File "/usr/lib/python2.6/site-packages/gdb/command/require.py", line
21, in <module>
    class RequireCommand (gdb.Command):
AttributeError: 'module' object has no attribute 'Command'
>>>
msg93282 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-29 12:12
It's a problem with one of your installed modules. I don't think Python
can do anything, unless you propose silencing all errors.
msg93361 - (view) Author: Jan Kratochvil (jankratochvil) Date: 2009-09-30 12:38
This patch will make the `modules' command succeeed.
Later requesting the specific `gdb' module will cause:

help> gdb
problem in gdb - <type 'exceptions.AttributeError'>: 'module' object has
no attribute 'Command'

I think this is right in general, a single broken module should not
abort the whole modules traversal.


Another issues is why the `gdb' module fails: It expects the bindings
inside the native `/usr/bin/gdb' process to exist.  Should it just
silently skip its functions if no `/usr/bin/gdb' binding is found?  Or
should these gdb modules be located outside of `/usr/lib*/python2.x'?
There are already some glue python modules
in `/usr/share/gdb/auto-load/'.  Thanks for advice.
msg93366 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-09-30 14:22
It may well be possible to improve the handling of exceptions (I haven't
looked at your patch yet), but fixing gdb, or rather the python bindings
for it, are out of the scope of this bug tracker since it is third-party
code.
msg93377 - (view) Author: Jan Kratochvil (jankratochvil) Date: 2009-09-30 22:14
The python bindings were therefore fixed downstream:
gdb-6.8.91.20090930-2.fc12
http://koji.fedoraproject.org/koji/buildinfo?buildID=134595
msg137999 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-09 16:11
Looks like this is an external bug.
msg145059 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-07 07:10
The problem of pydoc apropos failing due to exceptions raised by pkgutil walk_packages is fixed in 2.7.3 by the changes for Issue7425; they were already fixed in 3.x.
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51264
2011-10-07 07:10:20ned.deilysetnosy: + ned.deily
messages: + msg145059
resolution: not a bug -> duplicate

superseder: Improve the robustness of "pydoc -k" in the face of broken modules
2011-06-09 16:11:27eric.araujosetstatus: open -> closed

nosy: + eric.araujo
messages: + msg137999

resolution: not a bug
stage: test needed -> resolved
2009-09-30 22:14:00jankratochvilsetmessages: + msg93377
2009-09-30 14:22:42r.david.murraysetpriority: low

type: crash -> behavior
assignee: georg.brandl ->
components: + Library (Lib), - Documentation

nosy: + r.david.murray
messages: + msg93366
stage: test needed
2009-09-30 12:38:08jankratochvilsetfiles: + pkgutil.py.patch
keywords: + patch
messages: + msg93361
2009-09-30 12:28:18jankratochvilsetnosy: + jankratochvil
2009-09-29 12:12:11pitrousetnosy: + pitrou
messages: + msg93282
2009-09-29 06:38:07rishikeshcreate