On Thursday 11 January 2007 02:01, Fernando Perez wrote:
> On 1/10/07, Steve Chaplin <[EMAIL PROTECTED]> wrote:
> > On Mon, 2007-01-08 at 11:24 -0500, Darren Dale wrote:
> > > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkcair
> > >o.py", line 11, in ?
> > >     import matplotlib.backends.backend_cairo as be_cairo
> > > AttributeError: 'module' object has no attribute 'backends'
> >
> > The original matplotlib code is correct, you should be editing IPython
> > and correcting their bug!
>
> Well, I'd be delighted to correct the ipython bug, if only I
> understood exactly what the problem was...  As far as I can see, that
> code in ipython is simply calling
>
>         # Initialize matplotlib to interactive mode always
>         import matplotlib
>         from matplotlib import backends
>
> inside a function (the _matplotlib_config method).  I don't see a bug
> in that, but if you provide some pointers, I'll be happy to fix any
> issues that are on ipython's side of the fence.

I've been looking at this, but haven't made much progress. Try this with 
backend:gtkcairo in matplotlibrc:

$ python

>>> __import__('matplotlib.backends.backend_ps', globals(),\
locals(),['backend_ps'])

output:
<module 'matplotlib.backends.backend_ps' 
from '/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_ps.pyc'>

$ ipython

In [1]: __import__('matplotlib.backends.backend_ps', globals(),\
locals(),['backend_ps'])

output:
---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most recent 
call last)

/home/darren/<ipython console>

/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py
     54
     55 # a hack to keep old versions of ipython working with mpl
     56 if 'IPython.Shell' in  sys.modules:
---> 57     new_figure_manager, draw_if_interactive, show = pylab_setup()
     58

/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py in 
pylab_setup()
     24     time.sleep(1)
     25     backend_mod = __import__('matplotlib.backends.'+backend_name,
---> 26                              globals(),locals(),[backend_name])
     27
     28     # Things we pull in from all backends

/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkcairo.py
      7     import cairo.gtk
      8
----> 9 import matplotlib.backends.backend_cairo as be_cairo
     10 from   matplotlib.backends.backend_gtk import *
     11

AttributeError: 'module' object has no attribute 'backends'



If you change backend:gtkagg in matplotlibrc, then ipython doesnt complain. 
Very strange.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to