From 390da53d5eb74fb9fa7c47277ff1e841bbeaf2fd Mon Sep 17 00:00:00 2001 From: Steve Chaplin <> Date: Wed, 15 Sep 2010 21:18:15 +0800 Subject: Add 'wb' to write files in binary mode. --- test/isurface_create_from_png.py | 6 +++--- test/surface_create_for_stream.py | 4 ++-- test/surface_write_to_png.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/isurface_create_from_png.py b/test/isurface_create_from_png.py index 129016d..8d1ce5d 100755 --- a/test/isurface_create_from_png.py +++ b/test/isurface_create_from_png.py @@ -23,7 +23,7 @@ print "see %s output file" % outFileName # write to file object h, outFileName = tempfile.mkstemp(prefix='pycairo_', suffix='.png') os.close(h) -f=file(outFileName, "w") +f=file(outFileName, "wb") surface.write_to_png(f) f.close() print "see %s output file" % outFileName @@ -35,7 +35,7 @@ buf = StringIO.StringIO() surface.write_to_png(buf) png_string = buf.getvalue() buf.close() -f=file(outFileName, "w") +f=file(outFileName, "wb") f.write(png_string) f.close() print "see %s output file" % outFileName @@ -47,7 +47,7 @@ buf = cStringIO.StringIO() surface.write_to_png(buf) png_string = buf.getvalue() buf.close() -f=file(outFileName, "w") +f=file(outFileName, "wb") f.write(png_string) f.close() print "see %s output file" % outFileName diff --git a/test/surface_create_for_stream.py b/test/surface_create_for_stream.py index 61997e0..da543f2 100755 --- a/test/surface_create_for_stream.py +++ b/test/surface_create_for_stream.py @@ -30,7 +30,7 @@ class C(object): # a selection of possible args to surface.write_to_png() #fo = '/tmp/f.ps' -fo = file('/tmp/f.svg', 'w') +fo = file('/tmp/f.svg', 'wb') #fo = StringIO.StringIO() #fo = cStringIO.StringIO() #fo = sys.stdout @@ -76,6 +76,6 @@ surface.finish() # for testing StringIO: get data and write to file #string = fo.getvalue() -#f2 = file('/tmp/f.ps', 'w') +#f2 = file('/tmp/f.ps', 'wb') #f2.write(string) #f2.close() diff --git a/test/surface_write_to_png.py b/test/surface_write_to_png.py index 61674f4..eb2ddef 100755 --- a/test/surface_write_to_png.py +++ b/test/surface_write_to_png.py @@ -57,7 +57,7 @@ ctx.fill() # a selection of possible args to surface.write_to_png() #fo = '/tmp/f.png' -fo = file('/tmp/f.png', 'w') +fo = file('/tmp/f.png', 'wb') #fo = StringIO.StringIO() #fo = cStringIO.StringIO() #fo = sys.stdout @@ -68,6 +68,6 @@ surface.write_to_png(fo) # for testing StringIO: get data and write to file #string = fo.getvalue() -#f2 = file('/tmp/f.png', 'w') +#f2 = file('/tmp/f.png', 'wb') #f2.write(string) #f2.close() -- cgit v1.2.1