Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0.2, 1.0.3, and 1.0.4

stable settings: handle ImportError of pywintypes correctly

We cannot catch both ImportError and pywintypes.com_error at the same
level, because ImportError means pywintypes is not assigned.

Changeset 3dc907be1df0

Parent b198faa623b4

by Yuya Nishihara

Changes to one file · Browse files at 3dc907be1df0 Showing diff from parent b198faa623b4 Diff from another changeset...

 
103
104
105
106
107
108
 
 
 
 
 
 
109
110
111
 
103
104
105
 
 
 
106
107
108
109
110
111
112
113
114
@@ -103,9 +103,12 @@
  if os.name == 'nt':   try:   import pywintypes - from win32com.shell import shell, shellcon - appdir = shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_APPDATA) - except (ImportError, pywintypes.com_error): + try: + from win32com.shell import shell, shellcon + appdir = shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_APPDATA) + except pywintypes.com_error: + appdir = os.environ['APPDATA'] + except ImportError:   appdir = os.environ['APPDATA']   return os.path.join(appdir, 'TortoiseHg', appname)   else: