1

In my .bashrc I added the following:

export PYTHONPATH=$PYTHONPATH:/home/tbao/src/Cython-0.14.1

When I relogin, I get the error:

-bash: /home/tbao/src/Cython-0.14.1: is a directory

I want to add the the directory to my pythonpath, but I can't. What am I doing wrong?

user804649
  • 315
  • 2
  • 12
  • 1
    Does $PYTHONPATH contain spaces? – tc. Jun 18 '11 at 15:53
  • Try adding a `/` at the end and see if it works. – jitendra Jun 18 '11 at 15:57
  • I've added a / at the end and it doesn't work. PYTHONPATH does not contain spaces. I tried to echo $PYTHONPATH and got a newline, which was weird. – user804649 Jun 18 '11 at 16:01
  • There's more to this story. Something else in your initialization files (e.g. .bashrc, .profile, .bash_profile) is using or setting PYTHONPATH in an unexpected way. Can you find it? – Rob Davis Jun 18 '11 at 17:01
  • It sounds to me like there's an invisible character on that line of the .bashrc messing things up. Can you view it with something that shows invisibles and see if anything turns up? – Gordon Davisson Jun 18 '11 at 18:05
  • To check for non-printable characters in env-variables, you can use `env | cat -vet` then go through the output or use `env | od -c` – Fredrik Pihl Jun 19 '11 at 15:53

1 Answers1

2

I would guess that the comments about there being spaces in are spot on, to handle that, quote the right-hand side:

export PYTHONPATH="$PYTHONPATH:$HOME/src/Cython-0.14.1"

Can you share what the current value of PYTHONPATH currently is? Perhaps with something like:

echo $PYTHONPATH | tr : \\n

So it's split across multiple lines and easier to read.

Kyle Burton
  • 26,788
  • 9
  • 50
  • 60