Python examples do not work out of the box on Windows 10
Hi,
first I would like to thank you for this great library.
I managed to compile the library and the Python bindings with the MSVC17 compiler. The last step was nmake install. After this step, the following addional files are in the folder C:\Python38\Lib\site-packages:
script_client.cp38-win_amd64.pyd
rtde_receive.cp38-win_amd64.pyd
rtde_io.cp38-win_amd64.pyd
rtde_control.cp38-win_amd64.pyd
dashboard_client.cp38-win_amd64.pyd
If I now switch into ur_rtde/examples/py
and execute python forcemode_example.py
then I get the following error:
Traceback (most recent call last):
File "forcemode_example.py", line 1, in <module>
import rtde_control
ImportError: DLL load failed while importing rtde_control: Das angegebene Modul wurde nicht gefunden.
Starting from Python 3.8 on, Python cannot use the PATH
variable to find shared libraries. So it is not possible for the module to find rtde.dll
. My only solution was to add the following two lines to the top of the forcemode_example.py
script with the hardcaded path to the rtde.dll
folder.:
import os
os.add_dll_directory("C:/msvc17_64/usr/lib")
But I have the feeling, that this is not the right solution. Does anyone know what is the right way to tell a Python Module on Windows where to find a required DLL or do I have to install the DLL into the Windows\System32
directory?