Skip to content

Commit a691e9a

Browse files
committed
updating interactive python
the client should exit if the user provides an argument/command paired with anything other than python, as it is not really logical. We also exit if ipython is not able to be imported, vs. we previously switched over to python instead and issued a warning. Signed-off-by: vsoch <[email protected]>
1 parent 92914d5 commit a691e9a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/spack/spack/cmd/python.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ def python(parser, args, unknown_args):
5151
if unknown_args:
5252
tty.die("Unknown arguments:", " ".join(unknown_args))
5353

54-
# If arguments or a command are provided, just use python
55-
if args.python_args or args.python_command:
56-
args.python_interpreter = "python"
54+
# Only python has support for arguments / commands
55+
has_command = args.python_args or args.python_command
56+
if has_command and args.python_interpreter != "python":
57+
tty.die("Use the default python interpreter for args/commands.")
5758

5859
# Run user choose of interpreter
5960
if args.python_interpreter == "ipython":
@@ -69,8 +70,7 @@ def ipython_interpreter(args):
6970
try:
7071
import IPython
7172
except ImportError:
72-
tty.warning("ipython is not installed, using python.")
73-
return spack.cmd.python.python_interpreter(args)
73+
tty.die("ipython is not installed, install and try again.")
7474

7575
if "PYTHONSTARTUP" in os.environ:
7676
startup_file = os.environ["PYTHONSTARTUP"]

0 commit comments

Comments
 (0)