Merge pull request #57 from girtsf/master
cairo_backend.py: use BytesIO instead of StringIO
This commit is contained in:
commit
7030eee5e2
1 changed files with 3 additions and 6 deletions
|
|
@ -25,10 +25,7 @@ from .render import GerberContext, RenderSettings
|
|||
from .theme import THEMES
|
||||
from ..primitives import *
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except(ImportError):
|
||||
from io import StringIO
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
class GerberCairoContext(GerberContext):
|
||||
|
|
@ -125,9 +122,9 @@ class GerberCairoContext(GerberContext):
|
|||
self.surface.write_to_png(filename)
|
||||
|
||||
def dump_str(self):
|
||||
""" Return a string containing the rendered image.
|
||||
""" Return a byte-string containing the rendered image.
|
||||
"""
|
||||
fobj = StringIO()
|
||||
fobj = BytesIO()
|
||||
self.surface.write_to_png(fobj)
|
||||
return fobj.getvalue()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue