[matplotlib-devel] bug with pylab.text?

2010-01-29 Thread John Palmieri
I think I've found a bug in matplotlib.  I use Sage, which is based on
Python and included matplotlib.

sage: import pylab
sage: pylab.text(0.2, 0.2, r"$\left(2a = b\right)$")  # note \left(
and \right) work

sage: pylab.text(0.2, 0.5, r"$(2 \, a = b)$")   # note \, works

sage: pylab.savefig('a.png')
sage: pylab.text(0.2, 0.7, r"$\left(2 \, a = b\right)$")  # but
together they don't

sage: pylab.savefig('b.png')
ERROR: An unexpected error occurred while tokenizing input
...
AttributeError: 'Kern' object has no attribute 'height'

Is this repeatable for anyone else?  Would the full traceback be helpful?

-- 
J. H. Palmieri
jhpalmier...@gmail.com

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] matplotlib: two issues with MPLCONFIGDIR

2010-10-28 Thread John Palmieri
The Sage developers have found two issues with MPLCONFIGDIR:

 - First, when upgrading from version 0.99.3 to 1.0.0, the contents of
that directory seem to cause compatibility problems.  That is, once
you upgrade to a version of Sage using 1.0.0, it overwrites whatever
was in that directory, and then you get errors when using an older
version of Sage which still uses 0.99.3.  See
<http://trac.sagemath.org/sage_trac/ticket/9221#comment:82> for an
example of the sort of error which arises, and see
<http://trac.sagemath.org/sage_trac/ticket/6235> for our fix: in Sage,
we set MPLCONFIGDIR to different directories based on the version of
matplotlib.

 - Second, the following code in matplotlib/texmanager.py can cause a
race condition when creating MPLCONFIGDIR:

if not os.path.exists(texcache):
os.mkdir(texcache)

In particular, when running doctests for Sage, if MPLCONFIGDIR doesn't
exist, two different doctests can try to create it at the same time,
causing a problem.  (I've also heard people suggest that these sort of
race conditions can be security issues, but I don't know about the
validity of this.)  See
<http://trac.sagemath.org/sage_trac/ticket/10159> for our fix: we
replace those lines by

try:
os.mkdir(texcache)
except OSError, e:
assert e.errno==errno.EEXIST, 'Cannot create %s.' % texcache

(and also add "import errno" at the beginning of the file).

I'd be happy to hear any comments you might have about these.

-- 
John Palmieri

--
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel