summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-08 09:34:53 +0000
committerGeorg Brandl <georg@python.org>2006-03-08 09:34:53 +0000
commit725e6f9b7fe46cdf256b51c5a3c0072e4ca61133 (patch)
tree4bf2e2c65477c35c06ea80b0be8371b174fcb2a1 /Lib/pydoc.py
parentc934fb1acdab5c868b143d9ce1ff6ffe1ebffa84 (diff)
downloadcpython-725e6f9b7fe46cdf256b51c5a3c0072e4ca61133.tar.gz
Fix pydoc.synopsis() so that it doesn't error out with an unreadable
module.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 2bcf4c997b..ee45643b43 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