Skip to content

Commit d3192e5

Browse files
committed
Don't crash on non-readable python path.
This closes issue #197.
1 parent 5340c4f commit d3192e5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bpython/importcompletion.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ def find_modules(path):
110110
# Perhaps a zip file
111111
return
112112

113-
for name in os.listdir(path):
113+
try:
114+
filenames = os.listdir(path)
115+
except EnvironmentError:
116+
filenames = []
117+
for name in filenames:
114118
if not any(name.endswith(suffix[0]) for suffix in imp.get_suffixes()):
115119
# Possibly a package
116120
if '.' in name:

0 commit comments

Comments
 (0)