From 073dfd2cc79595316797cd4c2c9cf2d1d7c7e047 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Wed, 3 Feb 2016 14:31:31 -0800 Subject: [PATCH] fix file streaming examples in docs to open file in binary mode for python 3. --- README.md | 8 ++++---- msgpack.org.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a95d76a..4c7df1c 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,12 @@ A more complicated example: Streaming serialization with file-like objects: ``` python ->>> f = open('test.bin', 'w') +>>> f = open('test.bin', 'wb') >>> umsgpack.pack({u"compact": True, u"schema": 0}, f) >>> umsgpack.pack([1,2,3], f) >>> f.close() >>> ->>> f = open('test.bin') +>>> f = open('test.bin', 'rb') >>> umsgpack.unpack(f) {u'compact': True, u'schema': 0} >>> umsgpack.unpack(f) @@ -87,11 +87,11 @@ Python standard library style names `dump`, `dumps`, `load`, `loads` are also av >>> umsgpack.loads(_) {u'compact': True, u'schema': 0} >>> ->>> f = open('test.bin', 'w') +>>> f = open('test.bin', 'wb') >>> umsgpack.dump({u"compact": True, u"schema": 0}, f) >>> f.close() >>> ->>> f = open('test.bin') +>>> f = open('test.bin', 'rb') >>> umsgpack.load(f) {u'compact': True, u'schema': 0} >>> diff --git a/msgpack.org.md b/msgpack.org.md index d8a53b2..7cd2c1b 100644 --- a/msgpack.org.md +++ b/msgpack.org.md @@ -49,12 +49,12 @@ A more complicated example: Streaming serialization with file-like objects: ``` python ->>> f = open('test.bin', 'w') +>>> f = open('test.bin', 'wb') >>> umsgpack.pack({u"compact": True, u"schema": 0}, f) >>> umsgpack.pack([1,2,3], f) >>> f.close() >>> ->>> f = open('test.bin') +>>> f = open('test.bin', 'rb') >>> umsgpack.unpack(f) {u'compact': True, u'schema': 0} >>> umsgpack.unpack(f) @@ -89,11 +89,11 @@ available: >>> umsgpack.loads(_) {u'compact': True, u'schema': 0} >>> ->>> f = open('test.bin', 'w') +>>> f = open('test.bin', 'wb') >>> umsgpack.dump({u"compact": True, u"schema": 0}, f) >>> f.close() >>> ->>> f = open('test.bin') +>>> f = open('test.bin', 'rb') >>> umsgpack.load(f) {u'compact': True, u'schema': 0} >>>