I'm trying to programmatically determine the path to the included/installed DLL file for a particular package. I've read countless SO pages, but cannot find any solution. Perhaps I've missed something and it's not possible?
The package is capstone and was manually installed from sources with the python3 bindings on Windows via Cygwin. Everything works.
# python3 -c "import os,inspect,capstone; print(os.path.dirname(inspect.getfile(capstone)))"
/usr/lib/python3.6/site-packages/capstone-4.0.0rc1-py3.6.egg/capstone
# python3 -c "import capstone; print(capstone._lib)"
capstone.dll
- The path shown above is to the
*.eggfile, but that path doesn't actually exist,
unless you unzip the file. - Within the EGG file, the location is in
./*.egg/capstone/lib/capstone.dll - But in the OS, the real system location of
capstone.dllis in:
/usr/lib/python3.6/site-packages/capstone/lib
How can I get the true path (3) in Python3?
EDIT:
Perhaps this could be useful? But I've come up with this ugly thing, that could easily break, so hoping for a more pythonic way.
# python3 -c "import capstone; print('DLL path: %s' % capstone._path_list[4] + '/' + capstone.__name__ + '/lib/' + capstone._lib)"
DLL path: /usr/lib/python3.6/site-packages/capstone/lib/capstone.dll