Skip to content

Commit

Permalink
Don't warn if commands contain Python files after the first element.
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Feb 23, 2024
1 parent fdf7e99 commit b61a38d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lab/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,14 @@ def add_command(
if not command:
logging.critical(f'Command "{name}" must not be empty')

# Abort or at least warn if the command calls a Python script directly.
# Raise an error if the command calls a Python script directly.
msg = (
'Command "{name}" appears to call the Python script "{part}" directly. '
'Command "{name}" calls the Python script "{part}" directly. '
"To make sure the script uses the right Python interpreter, "
'please use "[..., sys.executable, "{part}", ...] instead.'
'please use "[sys.executable, "{part}", ...] instead.'
)
if command[0].endswith(".py"):
raise ValueError(msg.format(name=name, part=command[0]))
for part in command:
if part.endswith(".py"):
logging.warning(msg.format(name=name, part=part))

if "stdin" in kwargs:
logging.critical("redirecting stdin is not supported")
Expand Down

0 comments on commit b61a38d

Please sign in to comment.