Thijs Triemstra <li...@collab.nl> added the comment:

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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6079>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to