Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running Python bindings on Windows #538

Open
peci1 opened this issue Sep 15, 2024 · 1 comment
Open

Fix running Python bindings on Windows #538

peci1 opened this issue Sep 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@peci1
Copy link
Contributor

peci1 commented Sep 15, 2024

Environment

  • OS Version: Win 10
  • Source or binary build?
    source, gz-transport14

Description

  • Expected behavior: Python bindings work
  • Actual behavior: Python bindings do not work

Steps to reproduce

  1. Install gz-transport14 from source using colcon with dependencies from conda.
  2. Run python
  3. Type from gz.transport14 import Node

Output

Traceback (most recent call last):
  File "D:\programming\gz9-ws\gz-ws\src\gz-transport\python\examples\publisher.py", line 19, in <module>
    from gz.transport14 import Node
  File "D:\programming\gz9-ws\gz-ws\install\lib\python\gz\transport14\__init__.py", line 18, in <module>
    from ._transport import Node as _Node
ImportError: DLL load failed while importing _transport: module not found

See gazebosim/gazebo_test_cases#1545 for details.

Proposed solution

Add

import os
os.add_dll_directory("C:\\Path\to\\gz-ws\\install\\bin")

to the start of python/src/init.py .

The path has to point to the directory where gz-transport14.dll is installed.

I don't know if it's better to turn the py file into a py.in and configure it via cmake, or if there is a better way.

@traversaro
Copy link
Contributor

Related issue: gazebosim/gz-math#507 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Inbox
Development

No branches or pull requests

2 participants