diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-01-30 02:04:58 +0000 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-01-30 02:04:58 +0000 |
commit | f6465c23de0b25136cd24263011c6c8dbdfc6e4c (patch) | |
tree | 1f8eb71453f4f8653bf7fc49674ec5e90324378f | |
parent | f27f7694a3ea52959cd20d7bb55be476f74c1298 (diff) | |
download | cpython-git-f6465c23de0b25136cd24263011c6c8dbdfc6e4c.tar.gz |
Merged revisions 77836 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77836 | victor.stinner | 2010-01-30 03:00:26 +0100 (sam., 30 janv. 2010) | 2 lines
#7801: fix xmlrpclib binary example, open the picture in binary mode
........
-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 ee99950f07..f2b4736964 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: |