Revision: 5193
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5193&view=rev
Author:   mdboom
Date:     2008-05-19 12:05:23 -0700 (Mon, 19 May 2008)

Log Message:
-----------
[ 1966974 ] win32FontDirectory() can fail with access denied (Thanks,
Patrik Simons)

Modified Paths:
--------------
    branches/v0_91_maint/CHANGELOG
    branches/v0_91_maint/lib/matplotlib/font_manager.py

Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG      2008-05-19 12:55:47 UTC (rev 5192)
+++ branches/v0_91_maint/CHANGELOG      2008-05-19 19:05:23 UTC (rev 5193)
@@ -1,3 +1,6 @@
+2008-05-19 Fix crash when Windows can not access the registry to
+           determine font path [Bug 1966974, thanks Patrik Simons] - MGD
+
 2008-05-14 Don't use stat on Windows (fixes font embedding problem) - MGD
 
 2008-05-09 Fix /singlequote (') in Postscript backend - MGD

Modified: branches/v0_91_maint/lib/matplotlib/font_manager.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 12:55:47 UTC 
(rev 5192)
+++ branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 19:05:23 UTC 
(rev 5193)
@@ -107,14 +107,17 @@
     except ImportError:
         pass # Fall through to default
     else:
-        user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
         try:
+            user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
             try:
-                return _winreg.QueryValueEx(user, 'Fonts')[0]
-            except OSError:
-                pass # Fall through to default
-        finally:
-            _winreg.CloseKey(user)
+                try:
+                    return _winreg.QueryValueEx(user, 'Fonts')[0]
+                except OSError:
+                    pass # Fall through to default
+            finally:
+                _winreg.CloseKey(user)
+        except OSError:
+            pass # Fall through to default
     return os.path.join(os.environ['WINDIR'], 'Fonts')
 
 def win32InstalledFonts(directory=None, fontext='ttf'):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to