Author thijs
Recipients georg.brandl, thijs
Date 2009-05-21.17:20:19
SpamBayes Score 9.25404e-05
Marked as misclassified No
Message-id <1242926422.81.0.303472244743.issue6079@psf.upfronthosting.co.za>
In-reply-to
Content
On the same documentation page for Python 3.1b1 it shows a similar error 
for the ProtocolError example:

import xmlrpc.client

# create a ServerProxy with an invalid URI
proxy = xmlrpc.client.ServerProxy("http://invalidaddress/")

try:
    proxy.some_method()
except xmlrpc.client.ProtocolError, err:
    print("A protocol error occurred")
    print("URL: %s" % err.url)
    print("HTTP/HTTPS headers: %s" % err.headers)
    print("Error code: %d" % err.errcode)
    print("Error message: %s" % err.errmsg)

Throws this error:

  File "proto.py", line 8
    except xmlrpc.client.ProtocolError, err:
                                      ^
SyntaxError: invalid syntax

Which should be fixed with:

import xmlrpc.client

# create a ServerProxy with an invalid URI
proxy = xmlrpc.client.ServerProxy("http://invalidaddress/")

try:
    proxy.some_method()
except xmlrpc.client.ProtocolError as err:
    print("A protocol error occurred")
    print("URL: %s" % err.url)
    print("HTTP/HTTPS headers: %s" % err.headers)
    print("Error code: %d" % err.errcode)
    print("Error message: %s" % err.errmsg)
History
Date User Action Args
2009-05-21 17:20:23thijssetrecipients: + thijs, georg.brandl
2009-05-21 17:20:22thijssetmessageid: <1242926422.81.0.303472244743.issue6079@psf.upfronthosting.co.za>
2009-05-21 17:20:20thijslinkissue6079 messages
2009-05-21 17:20:19thijscreate