4

A python program needs to find the installation location of openoffice.org, which is installed on a Windows XP computer. What is the best way to do this?

1
  • You could have a look in the registry using something like win32api.RegConnectRegistry and win32api.RegOpenKeyEx. (I don't have access to a Windows PC to check at the moment... Commented Sep 19, 2011 at 8:30

1 Answer 1

8

You can use the _winreg module on windows: First find out the path in the registry (eg starting regedit.exe and using its find function). Then you can query this path as I did it once to find the home directory of R:

key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "Software\\R-core\\R")
value =  _winreg.QueryValueEx(key, "InstallPath")[0]

ADDED:

If you are not familiar with the windows regstry: have a look at http://en.wikipedia.org/wiki/Windows_Registry

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.