summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Chaplin <>2010-09-15 21:18:15 +0800
committerSteve Chaplin <>2010-09-15 21:18:15 +0800
commit390da53d5eb74fb9fa7c47277ff1e841bbeaf2fd (patch)
treef67d586b56324fd106237e12f2447c45f8638c1b
parentcb18f5dfbfa4e3e3a340bebd00153f4126449851 (diff)
downloadpycairo-390da53d5eb74fb9fa7c47277ff1e841bbeaf2fd.tar.gz
Add 'wb' to write files in binary mode.
-rwxr-xr-xtest/isurface_create_from_png.py6
-rwxr-xr-xtest/surface_create_for_stream.py4
-rwxr-xr-xtest/surface_write_to_png.py4
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()