Revision: 4790
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4790&view=rev
Author:   efiring
Date:     2007-12-26 09:10:34 -0800 (Wed, 26 Dec 2007)

Log Message:
-----------
Warning instead of exception if matplotlib.use() is called too late.

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/__init__.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2007-12-26 07:51:19 UTC (rev 4789)
+++ trunk/matplotlib/CHANGELOG  2007-12-26 17:10:34 UTC (rev 4790)
@@ -1,3 +1,6 @@
+2007-12-26 Reduce too-late use of matplotlib.use() to a warning
+           instead of an exception, for backwards compatibility - EF
+
 2007-12-25 Fix bug in errorbar, identified by Noriko Minakawa - EF
 
 2007-12-25 Changed masked array importing to work with the upcoming

Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-26 07:51:19 UTC (rev 
4789)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-26 17:10:34 UTC (rev 
4790)
@@ -727,8 +727,11 @@
     except:
         from config import rcParams, rcdefaults
 
-_use_error_msg = """ matplotlib.use() must be called *before* pylab
-or matplotlib.backends is imported for the first time."""
+_use_error_msg = """ This call to matplotlib.use() has no effect
+because the the backend has already been chosen;
+matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
+or matplotlib.backends is imported for the first time.
+"""
 
 def use(arg):
     """
@@ -747,7 +750,7 @@
     be called before importing matplotlib.backends.
     """
     if 'matplotlib.backends' in sys.modules:
-        raise RuntimeError(_use_error_msg)
+        warnings.warn(_use_error_msg)
     be_parts = arg.split('.')
     name = validate_backend(be_parts[0])
     rcParams['backend'] = name


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 2005.
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