mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #2676 from pypa/safe-venv-check
Ignore OSError in is_virtual_environment check
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Prevent crashing when a virtual environment in ``WORKON_HOME`` is faulty.
|
||||
+6
-2
@@ -1350,8 +1350,12 @@ def is_virtual_environment(path):
|
||||
if not path.is_dir():
|
||||
return False
|
||||
for bindir_name in ('bin', 'Scripts'):
|
||||
for python_like in path.joinpath(bindir_name).glob('python*'):
|
||||
if python_like.is_file() and os.access(str(python_like), os.X_OK):
|
||||
for python in path.joinpath(bindir_name).glob('python*'):
|
||||
try:
|
||||
exeness = python.is_file() and os.access(str(python), os.X_OK)
|
||||
except OSError:
|
||||
exeness = False
|
||||
if exeness:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user