Skip to content

Commit

Permalink
Committing suggest use of shutil.which instead of sys.executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
afisher1 committed Nov 12, 2024
1 parent e974723 commit 7dc5e6b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions helics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import platform
import urllib.request
import logging
import sys
import shutil
from ._version import __version__
from .status_checker import CheckStatusThread

Expand Down Expand Up @@ -307,8 +307,11 @@ def run(path, silent, connect_server, no_log_files, no_kill_on_error):
for k, v in f["env"].items():
env[k] = v
p_args = shlex.split(f["exec"])
if p_args[0] == 'python':
p_args[0] = sys.executable
p_args[0] = shutil.which(p_args[0])
if p_args[0] is None:
raise click.ClickException("UnrecognizedCommandError: The command specified in exec string is not a "
"recognized command in the system. The user provided exec string is "
f"{f["exec"]}.")
p = subprocess.Popen(
p_args,
cwd=os.path.abspath(os.path.expanduser(directory)),
Expand Down

0 comments on commit 7dc5e6b

Please sign in to comment.