|
From: John H. <jdh...@ac...> - 2005-05-14 21:05:24
|
>>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
Florian> Am Freitag, 13. Mai 2005 18:49 schrieb John Hunter:
>> >>>>> "Florian" == Florian Lindner <mai...@xg...>
>> writes:
>>
Florian> No. I pasted the complete script into the mail. There is
Florian> nothing else I execute...
>> Please post the following commands, or their equivalent for
>> your platform, and their output. Please include the commands
>> you actually type in your post.
>>
>> > cat test.py > /usr/bin/python2.4 ./test.py --verbose-helpful
Florian> Here we go:
Well, I'll be damned. I really can't believe this hasn't cropped up
before -- it's a real bug.
The errant code is in matplotlib/backends/__init___.py
# Import the requested backend into a generic module object
backend_name = 'backend_'+backend.lower()
backend_mod = __import__('matplotlib.backends.'+backend_name,
globals(),locals(),[backend_name])
Where the default backend is being imported. These changes were
introduced many moons ago by Fernando when he was cleaning up the
backend import for ipython/pylab. Then need top be moved to a
function or otherwise deferred until pylab asks for them, to prevent
the kind of problem you are seeing.
As a workaround, add these two lines at the top of your script:
import matplotlib
matplotlib.use('Agg')
or change the default backend in the rc file to 'Agg'. Even though
there are 2 good workarounds, I still consider this to be a little bug,
because the OO interface shouldn't be doing any magic like importing a
backend implicitly. Would you be willing to file a bug report on the
sourceforge site?
Thanks,
JDH
|