Re: [ros-users] PYTHONPATH in setup.sh

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] PYTHONPATH in setup.sh
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 <> 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@dice:~$ env | grep PYTHONPATH
> cmansley@dice:~$ export ROS_ROOT=/opt/ros/cturtle/ros
> cmansley@dice:~$ export PYTHONPATH=${ROS_ROOT}/core/roslib/src:${PYTHONPATH}
> cmansley@dice:~$ env | grep PYTHONPATH
> PYTHONPATH=/opt/ros/cturtle/ros/core/roslib/src:
> cmansley@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@dice:~$ unset PYTHONPATH
> cmansley@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@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
>
> https://code.ros.org/mailman/listinfo/ros-users
>
>