Revision: 3907
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3907&view=rev
Author:   efiring
Date:     2007-10-02 01:30:29 -0700 (Tue, 02 Oct 2007)

Log Message:
-----------
matplotlib.use() raises an exception if called too late

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

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2007-10-01 11:53:52 UTC (rev 3906)
+++ trunk/matplotlib/CHANGELOG  2007-10-02 08:30:29 UTC (rev 3907)
@@ -1,3 +1,6 @@
+2007-10-01 Made matplotlib.use() raise an exception if called after
+           backends has been imported.
+
 2007-09-30 Modified update* methods of Bbox and Interval so they
            work with reversed axes.  Prior to this, trying to
            set the ticks on a reversed axis failed with an

Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2007-10-01 11:53:52 UTC (rev 
3906)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-10-02 08:30:29 UTC (rev 
3907)
@@ -716,6 +716,9 @@
     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."""
+
 def use(arg):
     """
     Set the matplotlib backend to one of the known backends.
@@ -732,6 +735,8 @@
     for the first time; or, if you are not using pylab, it must
     be called before importing matplotlib.backends.
     """
+    if 'matplotlib.backends' in sys.modules:
+        raise RuntimeError(_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