Basically I want to get a handle of the python interpreter so I can pass a script file to execute (from an external application).
187
votes
@Bhargav Rao: how can this question, which was asked 1 year before the question that it is supposed to be a duplicate of, be a duplicate of it? It's the other way around.
- mhawke
@mhawke The other had more views than this and was better worded. Hence I duped it in the reverse direction. TBH, Both of them does say the same thing, So we can even flag for merger.
- Bhargav Rao♦
@BhargavRao: yes, it is better written and the title is probably responsible for that. Also the accepted answer is better and (now) includes a link to the documentation, so overall I think you're right.
- mhawke
3 Answers
309
votes
56
votes
7
votes
I think it depends on how you installed python. Note that you can have multiple installs of python, I do on my machine. However, if you install via an msi of a version of python 2.2 or above, I believe it creates a registry key like so:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Python.exe
which gives this value on my machine:
C:\Python25\Python.exe
You just read the registry key to get the location.
However, you can install python via an xcopy like model that you can have in an arbitrary place, and you just have to know where it is installed.