Opened 9 years ago

Last modified 7 years ago

#50785 closed defect

Can't import py27-cairosvg — at Initial Version

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

Description

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 (0)

Note: See TracTickets for help on using tickets.