ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

asked 2022-11-08 15:16:10 -0500

updated 2022-11-09 02:13:56 -0500

gvdhoorn gravatar image

execute this "rosrun ros_essentials_cpp 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
edit retag flag offensive close merge delete

Comments

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

gvdhoorn gravatar image gvdhoorn  ( 2022-11-09 02:14:14 -0500 )edit

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

ravijoshi gravatar image ravijoshi  ( 2022-11-09 02:26:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-08 16:09:29 -0500

duck-development gravatar image

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

edit flag offensive delete link more

Comments

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

Davies Ogunsina gravatar image Davies Ogunsina  ( 2022-11-29 13:12:36 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-11-08 15:16:10 -0500

Seen: 77 times

Last updated: Nov 09 '22