ROS Basics in 5 days - Python - Exercise 3.1

Hello, please help me, I’m super stuck. I think it’s telling me that my python file is not found when I try roslaunch, but I’ve tried everything I can think of, 10 times for the most part, I even deleted and rebuilt the package once or twice. I am not working with nothing but an exact copy of the solution, and it still isn’t working.

Thanks so much!

The problem is that you did not provide execution permissions to the Python file.

Go to unit_3_services/src and the provide execution permissions to the file

$ chmod +x

Let me know if that works

1 Like

Oh man, I knew it was going to be something that I’ve already done 20 times but was slipping my mind, yes that worked straight away, thanks so much! :smiley:


:grinning: Happy it was something so easy to solve!

Hey! I have the problem with the same exercise. I copied the python program, which is already writen:

#! /usr/bin/env python

import rospy
from std_msgs.msg import Int32

pub = rospy.Publisher(’/counter’, Int32, queue_size=1)
rate = rospy.Rate(2)
count = Int32() = 0
while not rospy.is_shutdown():
pub.publish(count)cd … += 1

But when i try to run it, it gives me this:

rosrun my_examples_pkg
File “/home/user/catkin_ws/src/my_examples_pkg/scripts/”, line 13
SyntaxError: invalid syntax

Does anybody now how to fix this?
Thank you for your answer

Oh, I have found the problem.
Thank you anyway.