[cairo] PyCairo on Mac OS X

Elver Loho elver.loho at gmail.com
Mon Apr 19 07:38:39 PDT 2010


It would appear that I've not named anything cairo.py by accident, but
that was a good guess -- I've had that problem before :)

YellowTracksuit:src 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__']
>>> cairo.__file__
'/Library/Python/2.6/site-packages/pycairo-1.8.8-py2.6-macosx-10.6-universal.egg/cairo/__init__.pyc'

Best,
Elver

elver.loho at gmail.com
+372 5661 6933
http://elver.wordpress.com/
skype: elver.loho

On 19 April 2010 00:31, Dane Springmeyer <blake at hailmail.net> wrote:
> 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