Robotics StackExchange | Archived questions

import tf error

how to solve the issue?

import tf
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/__init__.py", line 30, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/home/aimotion/catkin_ws/devel/lib/python3/dist-packages/tf2_ros/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 38, in <module>
  File "/home/aimotion/catkin_ws/devel/lib/python3/dist-packages/tf2_py/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 38, in <module>
ImportError: dynamic module does not define module export function (PyInit__tf2)

Asked by MPR on 2021-10-27 00:57:08 UTC

Comments

Answers

With melodic you are expected to use python2. Before you build again, make sure you delete the top-level devel and build directories in your catkin_ws.

Asked by Mike Scheutzow on 2021-10-27 07:02:21 UTC

Comments