diff options
author | Georg Brandl <georg@python.org> | 2006-03-08 09:34:53 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-08 09:34:53 (GMT) |
commit | 26fd2e1dcc6f07f6c58127a790312850849c1c60 (patch) | |
tree | 4ac365fc68aaa1b5546a759de4bea9a5a210633e | |
parent | 2f5e9903a0fa693670cded538dd42088cb2661cf (diff) | |
download | cpython-26fd2e1dcc6f07f6c58127a790312850849c1c60.zip cpython-26fd2e1dcc6f07f6c58127a790312850849c1c60.tar.gz cpython-26fd2e1dcc6f07f6c58127a790312850849c1c60.tar.bz2 |
Fix pydoc.synopsis() so that it doesn't error out with an unreadable
module.
-rwxr-xr-x | Lib/pydoc.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 2bcf4c9..ee45643 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -188,7 +188,11 @@ def synopsis(filename, cache={}): lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: info = inspect.getmoduleinfo(filename) - file = open(filename) + try: + file = open(filename) + except IOError: + # module can't be opened, so skip it + return None if info and 'b' in info[2]: # binary modules have to be imported try: module = imp.load_module('__temp__', file, filename, info[1:]) except: return None |