when i run script python (import rospy) i have this error

asked 2021-10-15 14:13:12 -0500

bilalhm gravatar image

updated 2021-10-15 14:56:09 -0500

gvdhoorn gravatar image

Straight dump of the traceback:

Traceback (most recent call last):
  File "haw.py", line 1, in <module>
    import rospy
  File "/usr/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/usr/lib/python3/dist-packages/rospy/client.py", line 54, in <module>
    import rospy.core
  File "/usr/lib/python3/dist-packages/rospy/core.py", line 75, in <module>
    from rosgraph_msgs.msg import Log
ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' (/opt/ros/foxy/lib/python3.8/site-packages/rosgraph_msgs/msg/__init__.py)
edit retag flag offensive close merge delete

Comments

I'm confused: rospy is ROS 1, but you've tagged the question with ros2and the traceback mentions ROS Foxy .. (which is ROS 2).

And rospy is not supposed to be in /usr/lib/python3, but in /opt/ros.

Is this a mixed ROS 1 + ROS 2 install where the ROS 1 packages are actually UpstreamPackages?

gvdhoorn gravatar image gvdhoorn  ( 2021-10-15 14:57:22 -0500 )edit