Is there a way to get the path of python27.dll from the python interpreter itself in windows.
I am looking for something like sys.executable that can get me the path to python27.dll ( just the directory ould do as well)
Python 2.7 is scheduled to be the last major version in the 2. x series before it moves into an extended maintenance period. This release contains many of the features that were first released in Python 3.1. Improvements in this release include: An ordered dictionary type.
New in Python version 2.5 is the ctypes, a foreign function library. It provides C-compatible data types and allows calling functions in DLLs or shared libraries. Using the ctypes module in Python allows ArcObjects code written in C++ to be used in a geoprocessing script tool.
You can use pywin32 to get a list of DLLs used by the python executable, then search those for python27.dll:
import win32process
for process in win32process.EnumProcessModules(-1):
name = win32process.GetModuleFileNameEx(-1, process)
if "python27.dll" in name:
print name
In the above example, -1 is the pseudo-process handle for the current process. You can also get the handle via:
curHandle = win32process.GetCurrentProcess()
pywin32 is available for download here:
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With