Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Have you remembered to do a catkin_make, then source devel/setup.bash before running the examples?

Without the proper environment setup, Python is not going to be able to find the ROS imports.

Have you remembered to do a catkin_make, then source devel/setup.bash before running the examples?

Without the proper environment setup, Python is not going to be able to find the ROS imports.


Edit:

Right. Two things: please don't use answers to answer someone else's answer (:)). Use comments for that. Also: please update your original question with the contents of the file you are trying to run (please use formatting for that: indent every line with 4 spaces).

Lastly: searching for Import Command not Found shows a lot of pages recommending me to make sure I have #!/usr/bin/env python at the top of my file. Do you? The error is probably really import: command not found, right?

Have you remembered to do a catkin_make, then source devel/setup.bash before running the examples?

Without the proper environment setup, Python is not going to be able to find the ROS imports.


Edit:

Right. Two things: please don't use answers to answer someone else's answer (:)). Use comments for that. Also: please update your original question with the contents of the file you are trying to run (please use formatting for that: indent every line with 4 spaces).

Lastly: searching for Import Command not Found shows a lot of pages recommending me to make sure I have #!/usr/bin/env python at the top of my file. Do you? The error is probably really import: command not found, right?


Edit2: I've fixed the formatting a bit.

  1. Can you confirm that your file is exactly like this?
  2. How do you exactly run your node?
  3. What is the output if you do python filename.py (change filename.py to the actual name)
  4. Did you by any chance create the file in Windows (running Ubuntu in a VM)? If so, could you try fromdos filename.py and see if the console output changes?

Have you remembered to do a catkin_make, then source devel/setup.bash before running the examples?

Without the proper environment setup, Python is not going to be able to find the ROS imports.


Edit:

Right. Two things: please don't use answers to answer someone else's answer (:)). Use comments for that. Also: please update your original question with the contents of the file you are trying to run (please use formatting for that: indent every line with 4 spaces).

Lastly: searching for Import Command not Found shows a lot of pages recommending me to make sure I have #!/usr/bin/env python at the top of my file. Do you? The error is probably really import: command not found, right?


Edit2: I've fixed the formatting a bit.

  1. Can you confirm that your file is exactly like this?
  2. How do you exactly run your node?
  3. Have you made your file executable (ie: chmod +x filename.py)?
  4. What is the output if you do python filename.py (change filename.py to the actual name)
  5. Did you by any chance create the file in Windows (running Ubuntu in a VM)? If so, could you try fromdos filename.py and see if the console output changes?