You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
#152
Open
shoaibmalek21 opened this issue
May 28, 2020
· 0 comments
def test_render_overlapping_touching():
"""Umaco example of D02 staring a second contour"""
_test_render(
"resources/example_overlapping_touching.gbr",
"golden/example_overlapping_touching.png",
)
gerber/tests/test_cairo_backend.py:82:
gerber/tests/test_cairo_backend.py:224: in _test_render
actual_bytes = ctx.dump(None)
def dump(self, filename=None, verbose=False):
""" Save image as `filename`
"""
try:
is_svg = os.path.splitext(filename.lower())[1] == '.svg'
except:
is_svg = False
if verbose:
print('[Render]: Writing image to {}'.format(filename))
if is_svg:
self.surface.finish()
self.surface_buffer.flush()
with open(filename, "wb") as f:
self.surface_buffer.seek(0)
f.write(self.surface_buffer.read())
f.flush()
else:
return self.surface.write_to_png(filename)
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
def dump(self, filename=None, verbose=False):
""" Save image as `filename`
"""
try:
is_svg = os.path.splitext(filename.lower())[1] == '.svg'
except:
is_svg = False
if verbose:
print('[Render]: Writing image to {}'.format(filename))
if is_svg:
self.surface.finish()
self.surface_buffer.flush()
with open(filename, "wb") as f:
self.surface_buffer.seek(0)
f.write(self.surface_buffer.read())
f.flush()
else:
return self.surface.write_to_png(filename)
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
def dump(self, filename=None, verbose=False):
""" Save image as `filename`
"""
try:
is_svg = os.path.splitext(filename.lower())[1] == '.svg'
except:
is_svg = False
if verbose:
print('[Render]: Writing image to {}'.format(filename))
if is_svg:
self.surface.finish()
self.surface_buffer.flush()
with open(filename, "wb") as f:
self.surface_buffer.seek(0)
f.write(self.surface_buffer.read())
f.flush()
else:
return self.surface.write_to_png(filename)
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
gerber/render/cairo_backend.py:150: TypeError
============================================================== warnings summary ==============================================================
gerber/tests/test_ipc356.py::TestRecord
cannot collect test class 'TestRecord' because it has a init constructor
gerber/tests/test_primitives.py::TestRecord
cannot collect test class 'TestRecord' because it has a init constructor
============================================================ test session starts =============================================================
platform linux2 -- Python 2.7.17, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
rootdir: /home/shoaib/pcb_development/pcb-tools, inifile:
collected 330 items
gerber/tests/test_am_statements.py .............................................. [ 13%]
gerber/tests/test_cairo_backend.py FFF. [ 15%]
gerber/tests/test_cam.py .......... [ 18%]
gerber/tests/test_common.py ... [ 19%]
gerber/tests/test_excellon.py ............................ [ 27%]
gerber/tests/test_excellon_statements.py ............................................................ [ 45%]
gerber/tests/test_gerber_statements.py .......................................................................... [ 68%]
gerber/tests/test_ipc356.py ....... [ 70%]
gerber/tests/test_layers.py ....... [ 72%]
gerber/tests/test_primitives.py ............................................................................ [ 95%]
gerber/tests/test_rs274x.py ..... [ 96%]
gerber/tests/test_rs274x_backend.py . [ 97%]
gerber/tests/test_utils.py ......... [100%]
================================================================== FAILURES ==================================================================
______________________________________________________ test_render_overlapping_touching ______________________________________________________
gerber/tests/test_cairo_backend.py:82:
gerber/tests/test_cairo_backend.py:224: in _test_render
actual_bytes = ctx.dump(None)
self = <gerber.render.cairo_backend.GerberCairoContext object at 0x7f418598a950>, filename = None, verbose = False
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
gerber/render/cairo_backend.py:150: TypeError
______________________________________________________ test_render_overlapping_contour _______________________________________________________
gerber/tests/test_cairo_backend.py:90:
gerber/tests/test_cairo_backend.py:224: in _test_render
actual_bytes = ctx.dump(None)
self = <gerber.render.cairo_backend.GerberCairoContext object at 0x7f41859b8690>, filename = None, verbose = False
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
gerber/render/cairo_backend.py:150: TypeError
_________________________________________________________ test_render_cutin_multiple _________________________________________________________
gerber/tests/test_cairo_backend.py:135:
gerber/tests/test_cairo_backend.py:224: in _test_render
actual_bytes = ctx.dump(None)
self = <gerber.render.cairo_backend.GerberCairoContext object at 0x7f41859534d0>, filename = None, verbose = False
E TypeError: Surface.write_to_png takes one argument which must be a filename, file object, or a file-like object which has a "write" method (like StringIO)
gerber/render/cairo_backend.py:150: TypeError
============================================================== warnings summary ==============================================================
gerber/tests/test_ipc356.py::TestRecord
cannot collect test class 'TestRecord' because it has a init constructor
gerber/tests/test_primitives.py::TestRecord
cannot collect test class 'TestRecord' because it has a init constructor
-- Docs: http://doc.pytest.org/en/latest/warnings.html
============================================== 3 failed, 327 passed, 2 warnings in 7.76 seconds =============================================
The text was updated successfully, but these errors were encountered: