From f2a75fade4723729fbe5e7199d17ed864ba71c87 2023-12-22 09:14:13 From: Matthias Bussonnier Date: 2023-12-22 09:14:13 Subject: [PATCH] Fix single ! raise error. Closes #14267 --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 6772740..1a73571 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2639,7 +2639,10 @@ class InteractiveShell(SingletonConfigurable): """ cmd = self.var_expand(cmd, depth=1) # warn if there is an IPython magic alternative. - main_cmd = cmd.split()[0] + if cmd == "": + main_cmd = "" + else: + main_cmd = cmd.split()[0] has_magic_alternatives = ("pip", "conda", "cd") if main_cmd in has_magic_alternatives: