T
Thomas Aanensen
Python could be located at different paths on computers (e.g. c:\python).
How can I find this path?
Thomas
How can I find this path?
Thomas
Thomas said:Python could be located at different paths on computers (e.g. c:\python).
How can I find this path?
PythonWin 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]Thomas said:Python could be located at different paths on computers (e.g. c:\python).
How can I find this path?
print sys.executable
Never trust the assumption:Thomas said:Thanks, but there is still one problem:
This leads to the path C:\python\Python23\pythonw.exe. In my application I
cannot use pythonw.exe, I need python.exe (console reasons). Is there some
way to get this instead?
If not, would it be ok to assume that python.exe will always reside in the
same directory as pythonw.exe?
'python.exe' ))
False
(This is from within Pythonwin, which has its executable elsewhere).
It's a good idea to check and see if the file really does exist. If it
doesn't, either raise an error to tell the user to figure out what's
wrong, or use the executable as given, (possibly checking/raising the
error *only* if the executable is named pythonw and you can't find the
python executable, though that would still have you running PythonWin in
the above example (checking for "not named python" would be safer)).
Well, doesn't exist on my win2k machine, at least. Using sys.executableThomas said:What about using PYTHONHOME as environment variable. Is that appropriate?
Mike said:Thomas Aanensen wrote:
Never trust the assumption:
'python.exe' ))
False
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.