elvish icon indicating copy to clipboard operation
elvish copied to clipboard

When running a python3 install for anything, you must surround the name with quotes

Open Uhm-why opened this issue 9 months ago • 1 comments

What happened, and what did you expect to happen?

When trying to install a package with python3, you get this error:

python3 -m pip install -U splat64[mips] Exception: index must be integer [tty 2]:1:27-39: python3 -m pip install -U splat64[mips]

You have to surround the package name with quotations to get it to run:

python3 -m pip install -U "splat64[mips]"

It gets annoying when you need to install multiple packages.

Is there a config that would prevent this from happening? Or, can elvish be patched to prevent this behavior?

Output of "elvish -version"

0.21.0+official

Code of Conduct

Uhm-why avatar Apr 14 '25 02:04 Uhm-why

It happens because square brackets are used for indexing:

~> echo splat64[3]
a

There is no config option to change this. And patching elvish to prevent it? That way lies madness, I think. If you start adding all sorts of exceptions to a nice regular syntax, the language gets too complicated and full of footguns.

There are other ways you can mitigate this. If you are installing multiple packages like this, presumably the command lines are very similar. Instead of retyping the whole command each time, consider using the up arrow to get the previous command line, then edit that for the next package and repeat. Or you can write a wrapper around python3 -m pip install … and use that instead.

hanche avatar Apr 22 '25 18:04 hanche