]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96861: Check for unset sys.executable during venv creation. (GH-96887)
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 17 Sep 2022 11:58:31 +0000 (14:58 +0300)
committerGitHub <noreply@github.com>
Sat, 17 Sep 2022 11:58:31 +0000 (12:58 +0100)
Lib/venv/__init__.py

index f6b790e1b71a13bf8ce4a3e34554861529bde100..034e3d4201772123378f89ff299cd4f805cd0bf8 100644 (file)
@@ -128,6 +128,11 @@ class EnvBuilder:
         context.prompt = '(%s) ' % prompt
         create_if_needed(env_dir)
         executable = sys._base_executable
+        if not executable:  # see gh-96861
+            raise ValueError('Unable to determine path to the running '
+                             'Python interpreter. Provide an explicit path or '
+                             'check that your PATH environment variable is '
+                             'correctly set.')
         dirname, exename = os.path.split(os.path.abspath(executable))
         context.executable = executable
         context.python_dir = dirname