diff --git a/tf2_py/package.xml b/tf2_py/package.xml index 4e6e98ff0b..e864096299 100644 --- a/tf2_py/package.xml +++ b/tf2_py/package.xml @@ -21,6 +21,7 @@ builtin_interfaces geometry_msgs rclpy + rpyutils ament_lint_auto ament_cmake_pytest diff --git a/tf2_py/test/test_buffer_core.py b/tf2_py/test/test_buffer_core.py index 98d6ae06e7..45721dbb7c 100644 --- a/tf2_py/test/test_buffer_core.py +++ b/tf2_py/test/test_buffer_core.py @@ -32,9 +32,14 @@ from geometry_msgs.msg import TransformStamped import rclpy - -from test_tf2_py._tf2_py import BufferCore -from test_tf2_py._tf2_py import LookupException +from rpyutils import add_dll_directories_from_env + +# Since Python 3.8, on Windows we should ensure DLL directories are explicitly added +# to the search path. +# See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew +with add_dll_directories_from_env('PATH'): + from test_tf2_py._tf2_py import BufferCore + from test_tf2_py._tf2_py import LookupException def build_transform(target_frame, source_frame, stamp): diff --git a/tf2_py/tf2_py/__init__.py b/tf2_py/tf2_py/__init__.py index b9b975159b..dea674a41f 100644 --- a/tf2_py/tf2_py/__init__.py +++ b/tf2_py/tf2_py/__init__.py @@ -33,4 +33,10 @@ # # Author: Eitan Marder-Eppstein # ********************************************************** -from tf2_py._tf2_py import * # noqa +from rpyutils import add_dll_directories_from_env + +# Since Python 3.8, on Windows we should ensure DLL directories are explicitly added +# to the search path. +# See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew +with add_dll_directories_from_env('PATH'): + from tf2_py._tf2_py import * # noqa