summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Chaplin <>2010-09-15 21:19:41 +0800
committerSteve Chaplin <>2010-09-15 21:19:41 +0800
commit6a0a09a7c37a54cce3b890f37965868e94539ed8 (patch)
tree12cef4744e0a603e8f42e8c7c7b9132d23d2616c
parent30fe91ce1c122f1a2ce5dfb742b7862474db826e (diff)
downloadpy2cairo-6a0a09a7c37a54cce3b890f37965868e94539ed8.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
-rwxr-xr-xtest/unicodeFilenames.py2
4 files changed, 8 insertions, 8 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()
diff --git a/test/unicodeFilenames.py b/test/unicodeFilenames.py
index 4378449..40d5b7d 100755
--- a/test/unicodeFilenames.py
+++ b/test/unicodeFilenames.py
@@ -15,7 +15,7 @@ import cairo
WIDTH, HEIGHT = 256, 256
-#f = open(u"a1ēxāmple.pdf","w")
+#f = open(u"a1ēxāmple.pdf","wb")
#surface = cairo.PDFSurface (f, WIDTH, HEIGHT)
surface = cairo.PDFSurface(u"a1ēxāmple.pdf", WIDTH, HEIGHT)