pythonenvironment-variablesfish

Append *multiple* paths to PYTHONPATH in fish


Here I read how to append to PYTHONPATH in fish, and that works fine for one string.

However, if I do this:

set --export PYTHONPATH $PYTHONPATH path1 path2

I get this:

>> import os
>> os.environ["PYTHONPATH"]
'path1\x1epath2'

Alternatively:

$ python -c "import os; print os.environ['PYTHONPATH']"
path1path2

What's wrong here?


Solution

  • You can set multiple paths by colon-separating the paths in the environment variable. I don't use fish, but in ZSH for instance, I'd do:

    $ export PYTHONPATH=/path/to/foo:/path/to/bar
    $ python -c "import sys; print sys.path"
    ['', '/path/to/foo', '/path/to/bar', ...