diff --git a/news/2676.bugfix b/news/2676.bugfix new file mode 100644 index 00000000..fb47d64b --- /dev/null +++ b/news/2676.bugfix @@ -0,0 +1 @@ +Prevent crashing when a virtual environment in ``WORKON_HOME`` is faulty. diff --git a/pipenv/utils.py b/pipenv/utils.py index 9cf62366..d07d36ab 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -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