When I launch a ROS node made in Python, the "ImportError: No module named scripts.scene" is raised
I have created the node using Python and following < http://www.ros.org/wiki/PyStyleGuide >. My layout is similar to "small modules with no msg/srvs".
anchor_mod
|- src/
|- anchor_mod.py
|- scripts/
|- scene/
|- __init.py__
|- object.py
|- simple_motion.py
|- utils/
|- __init.py__
|- trajectories.py
|- conceptual_spaces/
|- scene/
|- __init.py__
|- pmm.py
|- srm.py
|- tests/
|- test_gen_trajectory.py
And my "anchor_mod.py" is importing some classes (i.e Object) and functions from "scripts" folder.
#!/usr/bin/env python
import roslib; roslib.load_manifest('anchor_mod')
import rospy
from scripts.scene import object
if __name__ == '__main__':
obj = object.Object
When I launch the script by hand:
anchor_mod/src> ./anchor_mod.py
or using "rosrun":
rosrun anchor_mod anchor_mod.py
The following error is risen:
File "/home/dieesrod/Workspaces/ROS/fuerte/sandbox/chsys_exp/anchor_mod/src/anchor_mod.py", line 12, in <module>
from scripts.scene import object
ImportError: No module named scripts.scene
This error occurs whatever module from "script" folder is imported.
Why this error is risen? Do I have to add my "non-exporting python files" to ROSPATH, PYTHONPATH or other place? How I have to import modules? Do I have to use "import scripts.scene" or only "import scene"?
Thanks.
Originally posted by dgerod on ROS Answers with karma: 113 on 2013-02-12
Post score: 0