On 11/11/2010 09:54 AM, Kynn Jones wrote:
> On my system, the following 3-line script
>
> *import matplotlib
> matplotlib.use('Cairo')
> import matplotlib.pyplot as plt
> *
> fails with the error:
>
> * File "<path-to-mpl-egg>/matplotlib/backends/backend_cairo.py", line
> 34, in <module>
>     if cairo.version_info < _version_required:
> AttributeError: 'module' object has no attribute 'version_info'
> *
> It's easy to see that the bug is in matplotlib.backends.backend_cairo;
> here's the part of the code that produces the error:
>
> *try:
>    import cairo
> except ImportError:
>    raise ImportError("Cairo backend requires that pycairo is installed.")
>
> _version_required = (1,2,0)
> if cairo.version_info < _version_required:
>    raise ImportError ("Pycairo %d.%d.%d is installed\n"
> "Pycairo %d.%d.%d or later is required"
>                      % (cairo.version_info + _version_required))
> *
> Indeed, the cairo module has no version_info attribute:
>
> *% python
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
>> >> import cairo
>> >> cairo.version_info
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'version_info'
> *

Strange.  Looking at the source of 1.8.10 from the py2cairo git repo, I 
see version_info as well as version being included in the module via 
cairomodule.c.

> (FWIW, the version of pycairo I have installed is 1.8.10 .)

What happens if you do:

import cairo
print cairo.version


Eric

>
> So matplotlib.backends.backend_cairo needs some other way to determine
> the version number for the cairo module, but I don't understand this
> module sufficiently well to provide a patch for this bug.
>
> ~kj
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to