Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing 'modules' in the interactive help system fails when imports fail #46771

Closed
dennis mannequin opened this issue Mar 31, 2008 · 5 comments
Closed

Typing 'modules' in the interactive help system fails when imports fail #46771

dennis mannequin opened this issue Mar 31, 2008 · 5 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@dennis
Copy link
Mannequin

dennis mannequin commented Mar 31, 2008

BPO 2519
Nosy @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-04-07.20:10:54.688>
created_at = <Date 2008-03-31.07:39:54.775>
labels = ['type-feature', 'library']
title = "Typing 'modules' in the interactive help system fails when imports fail"
updated_at = <Date 2009-04-07.20:10:54.687>
user = 'https://bugs.python.org/dennis'

bugs.python.org fields:

activity = <Date 2009-04-07.20:10:54.687>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2009-04-07.20:10:54.688>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2008-03-31.07:39:54.775>
creator = 'dennis'
dependencies = []
files = []
hgrepos = []
issue_num = 2519
keywords = []
message_count = 4.0
messages = ['64778', '64799', '64817', '82601']
nosy_count = 2.0
nosy_names = ['benjamin.peterson', 'dennis']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue2519'
versions = ['Python 2.5']

@dennis
Copy link
Mannequin Author

dennis mannequin commented Mar 31, 2008

If a certain module cannot be imported, this error is not caught and
warned about by pydoc, but will cause 'modules' to fail. This could be
considered a bug in the module but it would still be nice if 3rd party
modules cannot break pydoc. Example:

dennis@mirage:~$ python
Python 2.5.2 (r252:60911, Mar 12 2008, 13:36:25) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.5! This is the online help utility.
[... snip ...]

help> modules

Please wait a moment while I gather a list of all available modules...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site.py", line 342, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib/python2.5/pydoc.py", line 1649, in __call__
    self.interact()
  File "/usr/lib/python2.5/pydoc.py", line 1667, in interact
    self.help(request)
  File "/usr/lib/python2.5/pydoc.py", line 1683, in help
    elif request == 'modules': self.listmodules()
  File "/usr/lib/python2.5/pydoc.py", line 1804, in listmodules
    ModuleScanner().run(callback)
  File "/usr/lib/python2.5/pydoc.py", line 1855, 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):

[... snip -- the actual error isn't important ...]
OperationalError: no such table: falcon_configurationkey

>>

I think it would be relatively easy to work around such bugs in 3rd
party modules by passing a callable to walk_packages that will give a
warning when an import fails instead of breaking.

@dennis dennis mannequin added the stdlib Python modules in the Lib dir label Mar 31, 2008
@benjaminp
Copy link
Contributor

Would you like to work on a patch?

@benjaminp benjaminp added the type-feature A feature request or enhancement label Apr 1, 2008
@dennis
Copy link
Mannequin Author

dennis mannequin commented Apr 1, 2008

pydoc.py from head actually does work around it in some places, but not
all. Will send a patch.

@dennis
Copy link
Mannequin Author

dennis mannequin commented Feb 22, 2009

I don't see this bug in python 3.0, so feel free to close this issue.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 15, 2022
…nGH-94794)

(cherry picked from commit 08f6897)

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
miss-islington added a commit that referenced this issue Jul 15, 2022
(cherry picked from commit 08f6897)

Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
@gvanrossum
Copy link
Member

gvanrossum commented Jul 15, 2022

If you got here from a commit adding docs for asyncio.timeout, there was a typo in the PR header, the correct issue for that is GH-90927. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants