From c2f7a62dbc0fbcb6f9676313adcd37db20af1840 2020-12-25 07:02:58 From: farisachugthai Date: 2020-12-25 07:02:58 Subject: [PATCH] BUG: Don't index args unless we know we can Otherwise we get an `IndexError` on any command that didn't require more arguments. For example running a bare `%conda` raises currently. In addition, `%conda list` raises as there aren't enough args for - args = args[1:] --- diff --git a/IPython/core/magics/packaging.py b/IPython/core/magics/packaging.py index 9f76088..e5e6877 100644 --- a/IPython/core/magics/packaging.py +++ b/IPython/core/magics/packaging.py @@ -82,8 +82,9 @@ class PackagingMagics(Magics): conda = _get_conda_executable() args = shlex.split(line) - command = args[0] - args = args[1:] + command = args[0] if len(args) > 0 else "" + args = args[1:] if len(args) > 1 else [""] + extra_args = [] # When the subprocess does not allow us to respond "yes" during the installation,