implement fix contributed by JamesBynd@bitbucket
authorrobin
Thu, 19 Mar 2015 17:41:11 +0000
changeset 4176 de929aeece02
parent 4175 f0bfab1d9277
child 4177 6ad8001471bb
implement fix contributed by JamesBynd@bitbucket
src/reportlab/__init__.py
src/reportlab/rl_config.py
--- a/src/reportlab/__init__.py	Thu Mar 19 16:02:32 2015 +0000
+++ b/src/reportlab/__init__.py	Thu Mar 19 17:41:11 2015 +0000
@@ -44,5 +44,5 @@
 except ImportError:
     try:
         _fake_import(os.path.expanduser(os.path.join('~','.reportlab_mods')),'reportlab_mods')
-    except ImportError:
+    except (ImportError,KeyError):
         pass
--- a/src/reportlab/rl_config.py	Thu Mar 19 16:02:32 2015 +0000
+++ b/src/reportlab/rl_config.py	Thu Mar 19 17:41:11 2015 +0000
@@ -31,8 +31,8 @@
         _overrides=_DEFAULTS.copy()
         try:
             try:
-                fn = os.path.expanduser(os.path.join('~','.reportlab_settings'))    #appengine fails with ImportError
-            except ImportError:
+                fn = os.path.expanduser(os.path.join('~','.reportlab_settings'))    #appengine fails with KeyError
+            except KeyError:
                 fn = None
             if fn:
                 with open(fn,'rb') as f:
@@ -96,8 +96,8 @@
                 d = (p % D).replace('/',os.sep)
                 if '~' in d:
                     try:
-                        d = os.path.expanduser(d)   #appengine fails with ImportError
-                    except ImportError:
+                        d = os.path.expanduser(d)   #appengine fails with KeyError
+                    except KeyError:
                         continue
                 if rl_isdir(d): P.append(d)
             _setOpt(k,os.pathsep.join(P),lambda x:x.split(os.pathsep))