Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3510 closed defect (fixed)

TA save png failed os8 xo-1.75

Reported by: tonyforster Owned by: walter
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Turtleart Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed


Traceback (most recent call last):

File "/home/olpc/Activities/TurtleArt.activity/TurtleArt/", line 482, in doevalstep

File "/home/olpc/Activities/TurtleArt.activity/TurtleArt/", line 461, in _evalsym

result = self.cfun.fcn(self, *self.arglist)

File "/home/olpc/Activities/TurtleArt.activity/plugins/turtle_blocks_extras/", line 238, in <lambda>

lambda self, x: primitive_dictionarysavepix?(x))

File "/home/olpc/Activities/TurtleArt.activity/plugins/turtle_blocks_extras/", line 1099, in _prim_save_picture

File "/home/olpc/Activities/TurtleArt.activity/TurtleArt/", line 3258, in save_as_image

save_picture(self.canvas, file_path)

File "/home/olpc/Activities/TurtleArt.activity/TurtleArt/", line 277, in save_picture


TypeError: Surface.write_to_png takes one argument which must be a filename (str), file object, or a file-like object which has a "write" method (like StringIO)

Attachments (2)

png fail.ta (5.0 KB) - added by tonyforster 9 years ago.
Image clipping type text.png (10.1 KB) - added by tonyforster 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by tonyforster

comment:1 Changed 9 years ago by tonyforster

  • Component changed from untriaged to Turtleart
  • Owner set to walter

comment:2 Changed 9 years ago by walter

This is a bit strange. The error is triggered because somehow the string you are using for the file name is type unicode instead of type string. Not sure how that could have happened. I'll add a conversion in these cases, but will also try to find the root cause, i.e., where the unicode conversion is happening.

if type(file_name) == unicode:

img_surface.write_to_png(str(file_name.encode('ascii', 'replace')))



comment:3 Changed 9 years ago by walter

  • Resolution set to fixed
  • Status changed from new to closed

fixed in v139, although the root cause is still somewhat of a mystery.

comment:4 Changed 9 years ago by tonyforster

works ok in v139

FWIW green text boxes are all type unicode and purple number boxes are all type float

comment:5 Changed 9 years ago by tonyforster

I wasn't quite right there, the text block on the pallette is type string but it becomes type unicode when edited

Changed 9 years ago by tonyforster

Note: See TracTickets for help on using tickets.