Skip to content

Commit 4d77ba4

Browse files
nicholasmhughess0undt3ch
authored andcommitted
fixes s0undt3ch/python-tools-scripts#40 traceback thrown during install reqs for virtualenv(changelog)
1 parent 586d3bf commit 4d77ba4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ptscripts/virtualenv.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,16 @@ def __enter__(self) -> VirtualEnv:
232232
except subprocess.CalledProcessError:
233233
msg = "Failed to create virtualenv"
234234
raise AssertionError(msg) from None
235-
self._install_requirements()
235+
try:
236+
self._install_requirements()
237+
except FileNotFoundError:
238+
# attempt to fix the virtualenv. delete and start over
239+
shutil.rmtree(str(self.venv_dir))
240+
try:
241+
self._create_virtualenv()
242+
except subprocess.CalledProcessError:
243+
msg = "Failed to create virtualenv"
244+
raise AssertionError(msg) from None
236245
self._add_as_extra_site_packages()
237246
return self
238247

0 commit comments

Comments
 (0)