mathtext error

I'm getting an error with a mathtext string from the mathtext_examples:

import matplotlib.pyplot as plt
ax = plt.subplot(111)
s = r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1
\rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d
\alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} -
\alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1
\sigma_2}}\right]$"

ax.text(1, 2, s)
plt.show()

johnh@...539...:~> python tmp/qslogo.py
Traceback (most recent call last):
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py",
line 331, in expose_event
    self._render_figure(self._pixmap, w, h)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure

...snipsnip

    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyparsing.py",
line 2304, in parseImpl
    raise ParseSyntaxException(pe)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyparsing.py",
line 216, in __init__
    super(ParseSyntaxException, self).__init__(
TypeError: super() argument 1 must be type, not classobj

Hmm... Can't reproduce this here. Maybe it's Python 2.4-specific (which I don't have).

As a workaround, does replacing line 216 with:

   ParseFatalException.__init__(self, pe.pstr, pe.loc, pe.msg, pe.parserElement)

work?

Mike

John Hunter wrote:

···

I'm getting an error with a mathtext string from the mathtext_examples:

import matplotlib.pyplot as plt
ax = plt.subplot(111)
s = r"W^\{3\\beta\}\_\{\\delta\_1 \\rho\_1 \\sigma\_2\} = U^\{3\\beta\}\_\{\\delta\_1 \\rho\_1\} \+ \\frac\{1\}\{8 \\pi 2\} \\int^\{\\alpha\_2\}\_\{\\alpha\_2\} d \\alpha^\\prime\_2 \\left\[\\frac\{ U^\{2\\beta\}\_\{\\delta\_1 \\rho\_1\} \- \\alpha^\\prime\_2U^\{1\\beta\}\_\{\\rho\_1 \\sigma\_2\} \}\{U^\{0\\beta\}\_\{\\rho\_1 \\sigma\_2\}\}\\right\]"

ax.text(1, 2, s)
plt.show()

johnh@...539...:~> python tmp/qslogo.py
Traceback (most recent call last):
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py",
line 331, in expose_event
    self._render_figure(self._pixmap, w, h)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure

...snipsnip

    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyparsing.py",
line 2304, in parseImpl
    raise ParseSyntaxException(pe)
  File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyparsing.py",
line 216, in __init__
    super(ParseSyntaxException, self).__init__(
TypeError: super() argument 1 must be type, not classobj

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA