Exceptions have no 'message' attribute

27 views
Skip to first unread message

vfxGer

unread,
Dec 9, 2011, 12:16:01 PM12/9/11
to JSON-RPC
Hi,
From what I can tell the json Exceptions have no 'message' attribute.
This means errors are not passed on.
I am using Python 2.4.3
Here is the result of the unit test that came with the checkout.
~/downloads/jsonRPC/trunk/python-jsonrpc : ./run-tests.py
test_RequestProcessing
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_findServiceEndpoint
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_handleBadRequestData
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_handleBadRequestObject
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_handleRequestEcho
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_handleRequestMethodNotAllowed
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_handleRequestMethodNotFound
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_handleRequestMethodRaiseError
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_invokeEndpoint
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_translateError
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ERROR
test_translateRequest
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_translateResults
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_translateUnencodableResults
(jsonrpc._tests.test_serviceHandler.TestServiceHandler) ... ok
test_MethodCallCallsService (jsonrpc._tests.test_proxy.TestProxy) ...
{"result":"foobar","error":null,"id":""}
{"result":null,"error":"MethodNotFound","id":""}
ok
test_ProvidesProxyMethod (jsonrpc._tests.test_proxy.TestProxy) ... ok
test_ServiceImplementationNotFound
(jsonrpc._tests.test_modpywrapper.TestModPyWrapper) ... ERROR
test_runHandler
(jsonrpc._tests.test_modpywrapper.TestModPyWrapper) ... ok
test_runCGIHandler (jsonrpc._tests.test_cgiwrapper.TestCGIWrapper) ...
ok
test_Array (jsonrpc._tests.test_json.TestDumps) ... ok
test_Boolean (jsonrpc._tests.test_json.TestDumps) ... ok
test_Dictionary (jsonrpc._tests.test_json.TestDumps) ... ok
test_FailOther (jsonrpc._tests.test_json.TestDumps) ... ok
test_Float (jsonrpc._tests.test_json.TestDumps) ... ok
test_None (jsonrpc._tests.test_json.TestDumps) ... ok
test_Number (jsonrpc._tests.test_json.TestDumps) ... ok
test_String (jsonrpc._tests.test_json.TestDumps) ... ok
test_StringEscapedChars (jsonrpc._tests.test_json.TestDumps) ... ok
test_StringEscapedUnicodeChars
(jsonrpc._tests.test_json.TestDumps) ... ok
test_Array (jsonrpc._tests.test_json.TestLoads) ... ok
test_Dictionary (jsonrpc._tests.test_json.TestLoads) ... ok
test_Exponential (jsonrpc._tests.test_json.TestLoads) ... ok
test_False (jsonrpc._tests.test_json.TestLoads) ... ok
test_Float (jsonrpc._tests.test_json.TestLoads) ... ok
test_Int (jsonrpc._tests.test_json.TestLoads) ... ok
test_NegativeInt (jsonrpc._tests.test_json.TestLoads) ... ok
test_NestedDictAllTypes (jsonrpc._tests.test_json.TestLoads) ... ok
test_None (jsonrpc._tests.test_json.TestLoads) ... ok
test_NumberAtEndOfArray (jsonrpc._tests.test_json.TestLoads) ... ok
test_StrAtEndOfArray (jsonrpc._tests.test_json.TestLoads) ... ok
test_String (jsonrpc._tests.test_json.TestLoads) ... ok
test_StringEscapedChars (jsonrpc._tests.test_json.TestLoads) ... ok
test_StringEscapedUnicodeChars
(jsonrpc._tests.test_json.TestLoads) ... ok
test_True (jsonrpc._tests.test_json.TestLoads) ... ok

======================================================================
ERROR: test_handleBadRequestData
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 146, in test_handleBadRequestData
result = handler.handleRequest(json)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: ServiceRequestNotTranslatable instance has no
attribute 'message'

======================================================================
ERROR: test_handleBadRequestObject
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 152, in
test_handleBadRequestObject
result = handler.handleRequest(json)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: BadServiceRequest instance has no attribute 'message'

======================================================================
ERROR: test_handleRequestMethodNotAllowed
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 134, in
test_handleRequestMethodNotAllowed
result = handler.handleRequest(json)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: ServiceMethodNotFound instance has no attribute
'message'

======================================================================
ERROR: test_handleRequestMethodNotFound
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 128, in
test_handleRequestMethodNotFound
result = handler.handleRequest(json)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: ServiceMethodNotFound instance has no attribute
'message'

======================================================================
ERROR: test_handleRequestMethodRaiseError
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 140, in
test_handleRequestMethodRaiseError
result = handler.handleRequest(json)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: Exception instance has no attribute 'message'

======================================================================
ERROR: test_translateError
(jsonrpc._tests.test_serviceHandler.TestServiceHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 111, in test_translateError
data=handler.translateResult(None, exc, "id")
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_serviceHandler.py", line 60, in translateResult
return jsonrpc.ServiceHandler.translateResult(self, result,
error, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: Exception instance has no attribute 'message'

======================================================================
ERROR: test_ServiceImplementationNotFound
(jsonrpc._tests.test_modpywrapper.TestModPyWrapper)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gkeating/downloads/jsonRPC/trunk/python-jsonrpc/jsonrpc/
_tests/test_modpywrapper.py", line 91, in
test_ServiceImplementationNotFound
rslt = jsonrpc.handler(req)
File "jsonrpc/modpywrapper.py", line 49, in handler
ModPyServiceHandler(req).handleRequest(req)
File "jsonrpc/modpywrapper.py", line 43, in handleRequest
resultData = ServiceHandler.handleRequest(self, data)
File "jsonrpc/serviceHandler.py", line 78, in handleRequest
resultdata = self.translateResult(result, err, id_)
File "jsonrpc/serviceHandler.py", line 104, in translateResult
err = {"name": err.__class__.__name__, "message":err.message}
AttributeError: ServiceImplementaionNotFound instance has no attribute
'message'

----------------------------------------------------------------------
Ran 43 tests in 0.010s

FAILED (errors=7)

Gerard Keating

unread,
Dec 9, 2011, 12:40:33 PM12/9/11
to JSON-RPC
Hi,
This is about python-jsonrpc, sorry I did not make that explicit in
the subject before.
It appears as if this is a python2.4.4 issue because it works fine in
Python 2.6.6
Anyone know a workaround since it would make my life easier to use
this in python2.4
Thanks.
Reply all
Reply to author
Forward
0 new messages