Here are the steps to reproduce:
create a new package under ~/catkin_ws/src:
catkin_create_pkg foopy rospy
create src/foopy folder and add init.py in it
create a main.py under scripts/ folder:
#!/usr/bin/env python
# -*- coding: utf-8
import roslib; roslib.load_manifest('foopy')
import rospy
import sys
for f in sys.path:
print f
Then chmod +x and execute it using:
rosrun foopy main.py
It prints:
/home/k/catkin_ws/src/foopy/scripts /usr/local/lib/python2.7/dist-packages /home/k/catkin_ws/devel/lib/python2.7/dist-packages /opt/ros/indigo/lib/python2.7/dist-packages /usr/lib/python2.7 ...
Which does not include module foopy of my src/foopy folder. So when I import anything created under src/foopy/, it will raise an ImportError.
How to solve this issue?
Originally posted by K Chen on ROS Answers with karma: 391 on 2016-01-07
Post score: 1