rospy module init_node fails?
I'm attempting to write a simple python node, but I can't even seem to get rospy imported into my script. Even just the import statement (after running chmod +x [filename]
) fails. I'm unable to run the tutorial python nodes as well. What are the possible reasons why this could be happening? I've been able to get a node running just fine on C++.
My (snipped) code, for reference:
#!/usr/bin/env python
import rospy
def main():
rospy.init_node("arm_gui")
main()
And the full error text:
rosrun SCARA_test_1 random.py
Traceback (most recent call last):
File "/home/mint/Documents/catkin_ws/src/SCARA_test_1/scripts/random.py", line 3, in <module>
import rospy
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
from .client import spin, myargv, init_node, \
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/client.py", line 46, in <module>
import random
File "/home/mint/Documents/catkin_ws/src/SCARA_test_1/scripts/random.py", line 34, in <module>
main()
File "/home/mint/Documents/catkin_ws/src/SCARA_test_1/scripts/random.py", line 30, in main
rospy.init_node("arm_gui")
AttributeError: 'module' object has no attribute 'init_node'
EDIT: Additional system info:
OS: Linux Mint 17.1 (Based on ubuntu 14.04)
ROS: Indigo
PYTHONPATH: /home/mint/Documents/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages
Can you please give some more details about your setup? What OS/ROS Distro do you have? What does your PYTHONPATH look like?
Ah, sorry. Edited post with additional info.