ROS Basics in 5 days - 3.1 Topic Publisher bash: simple_topic_publisher.py: command not found

Hello!
I’m doing a ROS Basics in 5 days course and in 3.1 when I try to run simple_topic_publisher.py i get:
bash: simple_topic_publisher.py: command not found
I think I did everything exactly as instructions says.
Somebody have any idea how to find a problem? I can paste something from the terminal if it’s needed.

TIA

you have two ways to run a script (noetic):

1 - python3 name_of_the_script in your case would be python simple_topic_publisher.py

2 - rosrun name_of_the_package name_of_the_script in your case asumming your package name is my_package would be: rosrun my_package simple_topic_publisher.py.

make sure you have set execution permisions of the script, if not, run: chmod +x simple_topic_publisher.py

1 Like

Ok, the second solution worked! Thanks a lot! In thin notebook it looked like:
rosrun my_examples_pkg
simple_topic_publisher.py
instead like
rosrun my_examples_pkg simple_topic_publisher.py
Stupid mistake…
@rtellez shouldn’t here be ‘$’ mark before rosrun in instruction?

1 Like