Ask Your Question
0

Scripts in /scripts cannot see files in /src/<package name>

asked 2017-07-30 09:11:41 -0500

jchernus gravatar image

I am receiving the following error when trying to run a script in my /catkin_ws/src/<package name="">/scripts directory.

robond@udacity:~/catkin_ws$ rosrun sensor_stick capture_features_new.py 
Traceback (most recent call last):
  File "/home/robond/catkin_ws/src/sensor_stick/scripts/capture_features_new.py", line 7, in <module>
    from sensor_stick.pcl_helper import *
ImportError: No module named pcl_helper

All of the files that I am importing from are present in catkin_ws/src/<package name="">/src/<package name="">. Yet, somehow they are invisible to my script...

I have run catkin_make, and sourced devel/setup.bash. A complete noob to ROS, I warn you.

Does anyone have any idea what I'm doing wrong? Thanks in advance!

edit retag flag offensive close merge delete

Comments

So after many hours of trying to fix the problem I gave up, copied the package &renamed it. Fiddled around, but it always failed to make, so I deleted it. Tried to make the original again, success, and now the script runs! But why...? Did it just need a clean?

jchernus gravatar image jchernus  ( 2017-07-30 10:08:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-02 08:13:54 -0500

naveedhd gravatar image

updated 2017-08-02 08:14:13 -0500

The reason it cannot find your module is that it is not in your $PYTHONPATH. The standard way of solving this would be to write a setup.py in your package and invoke catkin_python_setup() in CMakeLists.txt as described in the last portion of this article: http://wiki.ros.org/rospy_tutorials/Tutorials/Makefile

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-07-30 09:11:41 -0500

Seen: 339 times

Last updated: Aug 02 '17