So here is the full error:
$ rosrun turtlesim_cleaner1 rotate.py
Traceback (most recent call last):
File "/home/kwinklink/catkin_ws/src/turtlesim_cleaner1/src/turtlesim_cleaner1/rotate.py", line 2, in <module>
import rospy
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 47, in <module>
from std_msgs.msg import Header
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
from ._Bool import *
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_Bool.py", line 5, in <module>
import genpy
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/__init__.py", line 34, in <module>
from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 47, in <module>
import yaml
File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 399
class YAMLObject(metaclass=YAMLObjectMetaclass):
^
SyntaxError: invalid syntax
Here i have a picture of the error: enter image description here
I will appreciate any answers please help i have been workon on this error for a werry long time.
In my rotate.py i onli have#!/usr/bin/env python import rospy
I found the solution!
Turns out all I had to do was to change #!/usr/bin/env python import rospy To: #!/usr/bin/env python3 import rospy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With