[ros-users] PYTHONPATH in setup.sh

Chris Mansley cmansley at cs.rutgers.edu
Wed Sep 22 23:04:02 UTC 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100922/57ac482b/attachment-0002.html>


More information about the ros-users mailing list