[New-bugs-announce] [issue6079] SyntaxError in xmlrpc.client Fault example

Thijs Triemstra report at bugs.python.org
Thu May 21 18:11:59 CEST 2009


New submission from Thijs Triemstra <lists at collab.nl>:

The example is defined as:

import xmlrpc.client

proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
try:
    proxy.add(2, 5)
except xmlrpc.client.Fault, err:
    print("A fault occurred")
    print("Fault code: %d" % err.faultCode)
    print("Fault string: %s" % err.faultString)

Which throws the following error:

  File "test.py", line 6
    except xmlrpc.client.Fault, err:
                              ^
SyntaxError: invalid syntax

I think it should be defined instead as:

import xmlrpc.client

proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
try:
    proxy.add(2, 5)
except xmlrpc.client.Fault as err:
    print("A fault occurred")
    print("Fault code: %d" % err.faultCode)
    print("Fault string: %s" % err.faultString)

----------
assignee: georg.brandl
components: Documentation
messages: 88162
nosy: georg.brandl, thijs
severity: normal
status: open
title: SyntaxError in xmlrpc.client Fault example
type: compile error
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6079>
_______________________________________


More information about the New-bugs-announce mailing list