|
From: Kynn J. <ky...@gm...> - 2010-11-11 19:54:08
|
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'
*
(FWIW, the version of pycairo I have installed is 1.8.10 .)
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
|