[cairo] PyCairo on Mac OS X

Andrew Dalke dalke at dalkescientific.com
Fri Apr 30 03:24:33 PDT 2010


Elver Loho <elver.loho <at> gmail.com> writes:

> I've installed Cairo with Mac Ports. I've installed PyCairo with
> easy_install.
   ...
> AttributeError: 'module' object has no attribute 'ImageSurface'
  ...
> >>> cairo.__file__
> '/Library/Python/2.6/site-packages/pycairo-1.8.8-py2.6-macosx-10.6-
universal.egg/cairo/__init__.pyc'

I have the same problem, also with a MacPorts installation of cairo. I want
to use the system Python  though, and not the MacPorts-installed one.

The compile and install goes without a problem, but I can't see ImageSurface:

>>> import cairo
>>> cairo.__file__
'/Library/Python/2.6/site-packages/
pycairo-1.8.8-py2.6-macosx-10.6-universal.egg/cairo/__init__.pyc'
>>> cairo.ImageSurface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ImageSurface'
>>> import cairo._cairo
>>> cairo.ImageSurface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ImageSurface'
>>> cairo._cairo.ImageSurface
<type 'cairo.ImageSurface'>
>>> cairo._cairo.version
'1.8.8'
>>> 


% unzip -l '/Library/Python/2.6/site-packages/
pycairo-1.8.8-py2.6-macosx-10.6-universal.egg'
Archive:  /Library/Python/2.6/site-packages/
pycairo-1.8.8-py2.6-macosx-10.6-universal.egg
  Length     Date   Time    Name
 --------    ----   ----    ----
       55  04-30-10 10:39   cairo/__init__.py
      229  04-30-10 10:39   cairo/__init__.pyc
      276  04-30-10 10:39   cairo/_cairo.py
      554  04-30-10 10:39   cairo/_cairo.pyc
   353096  04-30-10 10:39   cairo/_cairo.so
        1  04-30-10 10:39   EGG-INFO/dependency_links.txt
       16  04-30-10 10:39   EGG-INFO/native_libs.txt
      200  04-30-10 10:39   EGG-INFO/PKG-INFO
      234  04-30-10 10:39   EGG-INFO/SOURCES.txt
        6  04-30-10 10:39   EGG-INFO/top_level.txt
        1  04-30-10 10:39   EGG-INFO/zip-safe
     7129  08-26-09 12:59   include/pycairo/pycairo.h
      191  04-30-10 10:39   lib/pkgconfig/pycairo.pc
 --------                   -------
   361988                   13 files


I looked into it a bit but ran into the confusion that setuptools
almost always gives me.

-- Andrew Dalke <dalke at dalkescientific.com>




More information about the cairo mailing list