According to the documentation,
On Linux, it is required to specify the filename including the
extension to load a library, so attribute access can not be used to
load libraries. Either the LoadLibrary() method of the dll loaders
should be used, or you should load the library by creating an instance
of CDLL by calling the constructor:
I am using a set of python scripts that have been developed externally. They require a rather standard lib (liblzma) and use LoadLibrary from ctypes to load it–via a pathname. My problem is that these scripts need to run on several different linux installs and potentially more in the future. The full file name of the liblzma shared library, as well as it’s location, varies from system to system. I’ve done testing against the various lib versions and there have found no conflicts.
What I really need is a way to determine the base name of the installed libs in order to pass the appropriate name to LoadLibrary.
I’ve considered just using ldconfig -p to print existing libs and parsing the output to find the lib names. Any other ideas?
I’m admittedly a bit out of my element here. The problematic scripts are merely a required piece of a larger project.
As long as the library is in the loader search path you can specify it by relative name.