[ros-users] $PYTHONPATH in launch files
HornungA at informatik.uni-freiburg.de
Fri May 28 19:19:59 UTC 2010
thanks for the clarifications. Things are a little clearer on my side
> 1. roslaunch automatically will include roslib/src on your
> PYTHONPATH in the remote launch
After Advait's example I had assumed that roslaunch resets the
PYTHONPATH, and then reads the manual override, which would have
resulted in the override needing to include the ROS path every time.
> 2. 3rdparty Python dependencies need to be system installed (via
> rosdep) or made into ROS packages, just like any other dependency, in
> order to be portable. If you follow this model, then there should be
> no need to set PYTHONPATH manually.
It's a third party library that is usually installed somewhere in a
user's home. I assume that adding the directory of its python interface
to the PYTHONPATH is the standard procedure. Of course there could also
be wrapping ROS package / manifest, but then a user would also have to
copy that into the library's dir and add it to the ROS_PACKAGE_PATH.
> 3. In the odd event that another location needs to be added to the
> PYTHONPATH, roslaunch supports an $(env FOO) syntax to parameterize
> this particular setting. This behavior is encouraged as it exposes the
> fact that any user of that launch file has to manually perform
> additional setup on each machine the launch file is used. You can
> also use $(env PYTHONPATH) to push your current PYTHONPATH to the
> remote machine, assuming you are using NFS or identical layouts.
Ah, that makes a lot of sense. I wasn't aware of that option, thinking
that the local PYTHONPATH would be stripped by roslaunch while in the
context of a launch file. That should definitely be mentioned or
stressed more in the wiki, because intuitively it does not look like
it's doing anything! For the record, adding:
<env name="PYTHONPATH" value="$(env PYTHONPATH)" />
to the launch file makes the nodes in it behave like they were started
from the command line, which is what I was looking for.
That only leaves one (slightly related) issue: The PYTHONPATH set up in
"setup.sh" when included e.g. in .bashrc. Is there a reason why that
should be completely reset to ROS' PYTHONPATH, and not appended like the
PATH environment variable?
Armin Hornung Albert-Ludwigs-Universität
www.informatik.uni-freiburg.de/~hornunga Dept. of Computer Science
HornungA at informatik.uni-freiburg.de Humanoid Robots Lab
Tel.: +49 (0)761-203-8010 Georges-Köhler-Allee 79
Fax : +49 (0)761-203-8007 D-79110 Freiburg, Germany
More information about the ros-users