Opened 9 years ago

Last modified 7 years ago

#50785 closed defect

py27-cairosvg: AttributeError: 'module' object has no attribute 'ANTIALIAS_FAST' — at Version 2

Reported by: DanielO (Daniel O'Connor) Owned by: sean@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: py27-cairosvg

Description (last modified by ryandesign (Ryan Carsten Schmidt))

In [20]: import cairosvg
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-20-8605454d1a82> in <module>()
----> 1 import cairosvg

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairosvg/__init__.py in <module>()
     25 import optparse
     26
---> 27 from . import surface
     28
     29

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairosvg/surface/__init__.py in <module>()
     45
     46 SHAPE_ANTIALIAS = {
---> 47     "optimizeSpeed": cairo.ANTIALIAS_FAST,
     48     "crispEdges": cairo.ANTIALIAS_NONE,
     49     "geometricPrecision": cairo.ANTIALIAS_BEST}

AttributeError: 'module' object has no attribute 'ANTIALIAS_FAST'

I worked around this by modifying /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cairosvg/surface/__init__.py and adding the following after the import statements

cairo.ANTIALIAS_FAST = cairo.ANTIALIAS_NONE
cairo.ANTIALIAS_GOOD = cairo.ANTIALIAS_SUBPIXEL
cairo.ANTIALIAS_BEST = cairo.ANTIALIAS_SUBPIXEL

Change History (2)

comment:1 Changed 9 years ago by DanielO (Daniel O'Connor)

Never mind, it's not actually a python SVG library! Note to self: read documentation first.

comment:2 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: changed from macports-tickets@… to sean@…
Summary: Can't import py27-cairosvgpy27-cairosvg: AttributeError: 'module' object has no attribute 'ANTIALIAS_FAST'
Note: See TracTickets for help on using tickets.