Определение рабочего каталога для ctypes ⇐ Python
-
Гость
Определение рабочего каталога для ctypes
I use ctypes to call functions in a C DLL. I followed the suggestions here and use this to open the library in my wrapper:
_lib = CDLL(dirname(__file__)+sep+'library.dll') However the library internally calls another file that is located in the same directory as the DLL. This file cannot be found when I call the wrapper from a different location. I always have to place a copy of the file in the working directory of my python console, which can be very unpractical.
Is there a way to define a working directory for the C DLL called by ctypes?
Источник: https://stackoverflow.com/questions/381 ... for-ctypes
I use ctypes to call functions in a C DLL. I followed the suggestions here and use this to open the library in my wrapper:
_lib = CDLL(dirname(__file__)+sep+'library.dll') However the library internally calls another file that is located in the same directory as the DLL. This file cannot be found when I call the wrapper from a different location. I always have to place a copy of the file in the working directory of my python console, which can be very unpractical.
Is there a way to define a working directory for the C DLL called by ctypes?
Источник: https://stackoverflow.com/questions/381 ... for-ctypes