From: <ef...@us...> - 2009-07-10 19:41:21
|
Revision: 7251 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7251&view=rev Author: efiring Date: 2009-07-10 19:41:12 +0000 (Fri, 10 Jul 2009) Log Message: ----------- Allow for broken wxversion in backend_wx Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-07-08 21:15:46 UTC (rev 7250) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-07-10 19:41:12 UTC (rev 7251) @@ -115,10 +115,15 @@ except ImportError: raise ImportError(missingwx) -try: - wxversion.ensureMinimal('2.8') -except wxversion.AlreadyImportedError: - pass +# Some early versions of wxversion lack AlreadyImportedError. +if hasattr(wxversion, 'AlreadyImportedError'): + try: + wxversion.ensureMinimal('2.8') + except wxversion.AlreadyImportedError: + pass +else: + warnings.warn( + "Update your wxversion.py to one including AlreadyImportedError") try: import wx @@ -126,6 +131,12 @@ except ImportError: raise ImportError(missingwx) +# Extra version check in case wxversion is broken: +major, minor = [int(n) for n in backend_version.split('.')[:2]] +if major < 2 or (major < 3 and minor < 8): + raise ImportError(missingwx) + + #!!! this is the call that is causing the exception swallowing !!! #wx.InitAllImageHandlers() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |