Robotics StackExchange | Archived questions

I am getting import error package not found when I execute the following "rosrun ros_essentials_cpp listener.py"

execute this "rosrun rosessentialscpp listener.py" get the above

import yaml   File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 399     class YAMLObject(metaclass=YAMLObjectMetaclass):                               ^ SyntaxError: invalid syntaximport yaml   File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 399     class YAMLObject(metaclass=YAMLObjectMetaclass):                               ^ SyntaxError: invalid syntaxlistener.py"import yaml   File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 399     class YAMLObject(metaclass=YAMLObjectMetaclass):                     import yaml   File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 399     class YAMLObject(metaclass=YAMLObjectMetaclass):    ^ SyntaxError: invalid syntax

Ubuntu 20.04

$ env | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/kbest/catkin_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/kbest/catkin_ws/devel/share/common-lisp
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic

Asked by flyingdutchman5564 on 2022-11-08 16:16:10 UTC

Comments

Please fix the traceback. It's all jumbled up.

Asked by gvdhoorn on 2022-11-09 03:14:14 UTC

Can you please provide a link to your code? Without seeing the code, it seems difficult to help you.

Asked by ravijoshi on 2022-11-09 03:26:20 UTC

Answers

Why is the pkg name with cpp and you run a python based node

Asked by duck-development on 2022-11-08 17:09:29 UTC

Comments

You have a listener.py node in the cpp pacakge ..I belive is just the name of the package.

Asked by Davies Ogunsina on 2022-11-29 14:12:36 UTC