[cairo] PyCairo on Mac OS X

Dane Springmeyer blake at hailmail.net
Sun Apr 18 14:31:01 PDT 2010


Did you accidentally name some python file 'cairo.py' that is also on  
your import path?

To confirm that '>>> import cairo' is really getting the pycairo  
module find the path to it:

import cairo
cairo.__file__

and make sure that points to the right thing (a cairo directory with  
an __init__.py and _cairo.so file within it).

Dane


On Apr 17, 2010, at 3:54 PM, Elver Loho wrote:

> Hi!
>
> I'm trying to install PyCairo on Mac OS X. Or, rather, I've done it.
> But it doesn't work.
> I've installed Cairo with Mac Ports. I've installed PyCairo with  
> easy_install.
> This is what happens when I try to use it:
>
> YellowTracksuit:~ elver$ python
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import cairo
>>>> dir(cairo)
> ['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
> '__package__', '__path__']
>>>> surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'ImageSurface'
>
> There be nothing there! What could be wrong and how do I fix it?
>
> Best,
> Elver
>
> elver.loho at gmail.com
> +372 5661 6933
> http://elver.wordpress.com/
> skype: elver.loho
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list