error locating backends module

Hello,

thank you for the respone. I am not working in such a file. I am experiencing strange behaviors when trying to import matplotlib. The error message “AttributeError: ‘module’ object has no attribute ‘backends’” seems to appear depending upon how I import matplotlib.

For example my wxApp is a simple frame holding a canvas and figure and a matplotlib toolbar. My canvas is a subclass of matplotlib’s canvas and my figure is a subclass of matplotlib’s Figure, my subclass modules are called myCanvas and myFigure.

the wxApp module import as follows:

import matplotlib

import myCanvas

the myCanvas module imports as follows:

import matplotlib

import myFigure

the myFigure module imports as follows:
import matplotlib
matplotlib.use(‘WXAgg’)
matplotlib.interactive(False)
matplotlib.backends.backend_wxagg._use_accelerator(True)

In this case the error occurs in the myFigure module where I call use_accelerator:

“myFigure.py”, line 19, in matplotlib.backends.backend_wxagg._use_accelerator(True)
AttributeError: ‘module’ object has no attribute ‘backends’"

If I comment out the call to use_accelerator, I get this message:

AttributeError: ‘module’ object has no attribute ‘figure’ and this occurs at the start of my subclass “class Figure(matplotlib.figure.Figure)”

Now everything works just great if in the wxApp module I do the following:

import matplotlib

from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg

import myCanvas

I can wrestle my way through this so that it appears to work ok. However I would prefer to understand what is happending and code this properly.

Also,

(1) I am not sure whether I need to call matplotlib.use(‘WxAgg’) or if it is implied when I import the WxAgg backend.

(2) what is the accelerator

(3) do I need to call matplotlib.interactive(False) in each module using matplotlib?

thanks for the help!

Jeff

···

— On Mon, 9/14/09, Damon McDougall <damon.mcdougall@…287…> wrote:

From: Damon McDougall <damon.mcdougall@…985…>
Subject: Re: [Matplotlib-users] error locating backends module
To: “Jeff Peery” <jeffpeery@…9…>
Date: Monday, September 14, 2009, 3:16 PM

Hi Jeff,

You don’t happen to be in the same directory as a folder called ‘matplotlib’ when trying to import matplotlib.backends, do you? If so, try moving to a different directory before invoking python and importing matplotlib.backends.

Regards,

–Damon

On 14 Sep 2009, at 22:52, Jeff Peery wrote:

hello,

I’m trying to import matplotlib.backends but I get a message indicating that matplotlib has no module ‘backends’. So I looked to confirm that it was there and it is. I also checked if other modules where available (by importing them from the command line) and it appears that all the module are available but NOT any of the packages located in the matplotlib installation folder.

I just downloaded the latest matplotlib and installed it on a brand new machine that is running vista. I’m running python 2.6.

how do I fix this problem?

thanks,

Jeff


Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options