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: