def locate_arcgis():
try:<EOL><INDENT>key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,<EOL>'<STR_LIT>', <NUM_LIT:0>)<EOL>version = _winreg.QueryValueEx(key, "<STR_LIT>")[<NUM_LIT:0>][:<NUM_LIT:4>]<EOL>key_string = "<STR_LIT>".format(version)<EOL>desktop_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,<EOL>key_string, <NUM_LIT:0>)<EOL>install_dir = _winreg.QueryValueEx(desktop_key, "<STR_LIT>")[<NUM_LIT:0>]<EOL>return install_dir<EOL><DEDENT>except WindowsError:<EOL><INDENT>raise ImportError("<STR_LIT>")<EOL><DEDENT>
Find the path to the ArcGIS Desktop installation.

Keys to check:

HLKM/SOFTWARE/ESRI/ArcGIS 'RealVersion' - will give the version, then we can use
that to go to
HKLM/SOFTWARE/ESRI/DesktopXX.X 'InstallDir'. Where XX.X is the version

We may need to check HKLM/SOFTWARE/Wow6432Node/ESRI instead