Skip to content

Commit ee9d84c

Browse files
committed
Ignore directories in PATH that can't be opened (#2794)
When enumerating over search paths in `$PATH`, ignore any entry where `Path.iterdir()` fails or produces no results.
1 parent 7365ad2 commit ee9d84c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/virtualenv/discovery/builtin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def get_paths(env: Mapping[str, str]) -> Generator[Path, None, None]:
171171
if path:
172172
for p in map(Path, path.split(os.pathsep)):
173173
with suppress(OSError):
174-
if p.exists():
174+
if next(p.iterdir(), None):
175175
yield p
176176

177177

0 commit comments

Comments
 (0)