[ros-users] PYTHONPATH in setup.sh

Ken Conley kwc at willowgarage.com
Wed Sep 22 23:20:32 UTC 2010


Hi Chris,

I'm on Ubuntu can't reproduce your error. Do you have any idea why
your python might behave that way? *PATH environment variables are
generally robust to extra colons.

Have you tried debugging the import site failure? This web page
suggests some steps:
http://james.wheare.org/notes/2009/02/import-site-failed-use-v-for-traceback.php

Here's my output from both a Karmic and Lucid setup:

$  cat /etc/issue
Ubuntu 9.10 \n \l

$ unset PYTHONPATH
$ . /opt/ros/cturtle/setup.sh
$ echo $PYTHONPATH
/opt/ros/cturtle/ros/core/roslib/src:
$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ cat /etc/issue
Ubuntu 10.04.1 LTS \n \l

$ unset PYTHONPATH
$ . /opt/ros/cturtle/setup.sh
$ echo $PYTHONPATH
/opt/ros/cturtle/ros/core/roslib/src:
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


On Wed, Sep 22, 2010 at 4:04 PM, Chris Mansley <cmansley at cs.rutgers.edu> wrote:
> All,
> I believe I must be doing something wrong. In the default install of Cturtle
> on Ubuntu 10.04, the setup.sh script doesn't jive well with an empty
> PYTHONPATH environmental variable. Here is my simple debugging test. Note
> the error on the first run of the python command.
>
> cmansley at dice:~$ env | grep PYTHONPATH
> cmansley at dice:~$ export ROS_ROOT=/opt/ros/cturtle/ros
> cmansley at dice:~$ export PYTHONPATH=${ROS_ROOT}/core/roslib/src:${PYTHONPATH}
> cmansley at dice:~$ env | grep PYTHONPATH
> PYTHONPATH=/opt/ros/cturtle/ros/core/roslib/src:
> cmansley at dice:~$ python
> 'import site' failed; use -v for traceback
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> Terminated
> cmansley at dice:~$ unset PYTHONPATH
> cmansley at dice:~$ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> Terminated
> cmansley at dice:~$
>
> I believe you need to test if the PYTHONPATH is empty before appending the
> colon, something like
> if [ -n ${PYTHONPATH} ]; then PYTHONPATH=:${PYTHONPATH} fi
> export PYTHONPATH=${ROS_ROOT}/core/roslib/src${PYTHONPATH}
> -chris
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>



More information about the ros-users mailing list