Addon Manager: Error checking when Python can't be found

This commit is contained in:
Chris Hennes
2022-09-27 11:32:51 -05:00
parent a157e6fcea
commit 0edb57d205

View File

@@ -77,9 +77,9 @@ def call_pip(args) -> List[str]:
python_exe = utils.get_python_exe()
pip_failed = False
if python_exe:
call_args = [python_exe, "-m", "pip", "--disable-pip-version-check"]
call_args.extend(args)
try:
call_args = [python_exe, "-m", "pip", "--disable-pip-version-check"]
call_args.extend(args)
proc = subprocess.run(
call_args,
stdout=subprocess.PIPE,
@@ -101,15 +101,15 @@ def call_pip(args) -> List[str]:
)
FreeCAD.Console.PrintLog(" ".join(call_args))
pip_failed = True
else:
pip_failed = True
result = []
if not pip_failed:
data = proc.stdout.decode()
result = data.split("\n")
result = []
if not pip_failed:
data = proc.stdout.decode()
result = data.split("\n")
else:
raise Exception(proc.stderr.decode())
else:
raise Exception(proc.stderr.decode())
raise Exception("Could not locate Python executable on this system")
return result