Skip to content

Commit 1fb4041

Browse files
committed
Handle OSError again
1 parent 274f423 commit 1fb4041

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bpython/importcompletion.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,14 @@ def find_modules(self, path: Path) -> Generator[Optional[str], None, None]:
175175
# Path is on skiplist
176176
return
177177

178+
try:
179+
children = path.iterdir()
180+
except OSError:
181+
# Path is not readable
182+
return
183+
178184
finder = importlib.machinery.FileFinder(str(path), *LOADERS) # type: ignore
179-
for p in path.iterdir():
185+
for p in children:
180186
if p.name.startswith(".") or p.name == "__pycache__":
181187
# Impossible to import from names starting with . and we can skip __pycache__
182188
continue

0 commit comments

Comments
 (0)