diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-01-30 02:00:26 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-01-30 02:00:26 (GMT) |
commit | 75d3fb1ebb13b143b2840b761b736237bf48f714 (patch) | |
tree | 22442b557afd05e48f348ccee31e03e822955b27 /Doc | |
parent | 721caaa9cef2980a27054d7b99a77e16767b14e9 (diff) | |
download | cpython-75d3fb1ebb13b143b2840b761b736237bf48f714.zip cpython-75d3fb1ebb13b143b2840b761b736237bf48f714.tar.gz cpython-75d3fb1ebb13b143b2840b761b736237bf48f714.tar.bz2 |
#7801: fix xmlrpclib binary example, open the picture in binary mode
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/xmlrpclib.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst index ee99950..f2b4736 100644 --- a/Doc/library/xmlrpclib.rst +++ b/Doc/library/xmlrpclib.rst @@ -318,7 +318,7 @@ XMLRPC:: import xmlrpclib def python_logo(): - with open("python_logo.jpg") as handle: + with open("python_logo.jpg", "rb") as handle: return xmlrpclib.Binary(handle.read()) server = SimpleXMLRPCServer(("localhost", 8000)) @@ -332,7 +332,7 @@ The client gets the image and saves it to a file:: import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8000/") - with open("fetched_python_logo.jpg", "w") as handle: + with open("fetched_python_logo.jpg", "wb") as handle: handle.write(proxy.python_logo().data) .. _fault-objects: |