Revision: 3740
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3740&view=rev
Author:   mdboom
Date:     2007-08-27 12:32:38 -0700 (Mon, 27 Aug 2007)

Log Message:
-----------
Better mathtext error messages.  Fix bug when using \sqrt without
explicit root.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/mathtext.py

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-27 18:51:22 UTC (rev 
3739)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-27 19:32:38 UTC (rev 
3740)
@@ -1932,7 +1932,14 @@
 
     def parse(self, s, fonts_object, fontsize, dpi):
         self._state_stack = [self.State(fonts_object, 'default', fontsize, 
dpi)]
-        self._expression.parseString(s)
+        try:
+            self._expression.parseString(s)
+        except ParseException, err:
+            raise ValueError("\n".join([
+                        "",
+                        err.line,
+                        " " * (err.column - 1) + "^",
+                        str(err)]))
         return self._expr
 
     # The state of the parser is maintained in a stack.  Upon
@@ -2155,7 +2162,7 @@
                 super = next1
                 sub = next2
         else:
-            raise ParseFatalException("Subscript/superscript sequence is too 
long.")
+            raise ParseFatalException("Subscript/superscript sequence is too 
long.  Use braces { } to remove ambiguity.")
 
         state = self.get_state()
         rule_thickness = state.font_output.get_underline_thickness(
@@ -2277,7 +2284,7 @@
             state.font, state.fontsize, state.dpi)
 
         if root is None:
-            root = Box()
+            root = Box(0., 0., 0.)
         else:
             if not isinstance(root, ParseResults):
                 raise ParseFatalException(


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to