ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

PYTHONPATH is not set correctly by source devel/setup.bash

asked 2016-01-04 09:42:13 -0500

martin1412 gravatar image

I am having some issues with the PYTHONPATH that is set by my ROS environment.

my .bashrc contains the following lines:

source /opt/ros/jade/setup.bash
source /home/x/workspace/devel/setup.bash

If I print my PYTHONPATH in a new bash it looks like this:

PYTHONPATH=/home/x/workspace/devel/lib/python2.7/dist-packages

The PYTHONPATH contains only workspace-specific packages.

This results in failure, when trying to import the catkin package from a python interpreter (as it is for example required when importing a rosnode project in qtcreator)

I investigated this problem a little bit, and it seems as if the first sourcing command sets the

PYTHONPATH=/opt/ros/jade/lib/python2.7/dist-packages

(which is where the catkin package is found) The second sourcing command however resets the path, and only appends the workspace specific part again.

Is this the intended behavior?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-01-21 07:00:13 -0500

martin1412 gravatar image

I don't really know what the problem was, I removed the whole workspace and set it up again. It seems to work now

edit flag offensive delete link more
0

answered 2016-01-21 05:26:29 -0500

gvdhoorn gravatar image

Is this the intended behavior?

Most likely, yes. I see this:

source /opt/ros/jade/setup.bash
source /home/x/workspace/devel/setup.bash

more and more on ROS Answers, and I'm not sure why. The second source .. line will cause that setup.bash to overwrite environment variables set by the first one.

Can you clarify why you have your .bashrc setup like that?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2016-01-04 09:42:13 -0500

Seen: 4,460 times

Last updated: Jan 21 '16