Syntax Error in Solution for Exercise 4.1 Understanding ROS2 Services: Clients & Servers

except for Exception as e:
# Display the message on the console
client.get_logger().info(
‘Service call failed %r’ % (e,))

should be without the ‘for’ within the exception call

Hi @max.tadeusz.zieba ,

It is actually a syntax error.

It should read except Exception as e, without the for literal / keyword.
I have mentioned about this error here: Tutorial Code Modification Suggestion - ROS2 Basics in 5 Days - Python

Regards,
Girish

Great! I checked your post but it seems that this wasn’t fixed. Let’s hope it will get caught up with another patch.

@girishkumar.kannan @max.tadeusz.zieba
Sorry, my bad. I didn’t realize that the except for Exception bug (which would throw an Exception rather than catch one :frowning_face:) appeared in several places. I have now corrected all instances of this bug.

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.