[Twisted-Python] CopyableFailure fails

Wolfgang Rohdewald wolfgang at rohdewald.de
Mon Feb 6 19:41:20 EST 2012


Am Montag, 6. Februar 2012, 23:12:29 schrieb exarkun at twistedmatrix.com:
> On 08:07 pm, wolfgang at rohdewald.de wrote:
> >Hi,
> 
> >with twisted 11.0.0 and python 2.7, my error fails here:
> Hello,
> 
> Please provide a minimal example reproducing the problem so we can 
> discuss it.  See http://sscce.org/ for more details.

I was hoping it would be self-evident. Trimming this to a short example 
could be rather much work. I hope the full backtrace will help.

anyway I overlooked the fact that two backtraces are printed where
the first on gives me my own calling stack. But the second one
(UnicodeEncodeError) should not happen IMHO, and it does not with my patch.

Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 1348, in remote_respond
    d = self.portal.login(self, mind, IPerspective)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/cred/portal.py", line 116, in login
    ).addCallback(self.realm.requestAvatar, mind, *interfaces
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 297, in addCallback
    callbackKeywords=kw)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 286, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 542, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/hdd/pub/src/gitgames/kajongg/src/server.py", line 956, in requestAvatar
    avatar.attached(mind)
  File "/hdd/pub/src/gitgames/kajongg/src/server.py", line 908, in attached
    self.server.login(self)
  File "/hdd/pub/src/gitgames/kajongg/src/server.py", line 717, in login
    self.loadSuspendedTables(user)
  File "/hdd/pub/src/gitgames/kajongg/src/server.py", line 889, in loadSuspendedTables
    table = Table(self, None, Ruleset.cached(ruleset, used=True), playOpen, autoPlay=False, seed=seed)
  File "/hdd/pub/src/gitgames/kajongg/src/scoringengine.py", line 77, in cached
    result = Ruleset(name, used)
  File "/hdd/pub/src/gitgames/kajongg/src/scoringengine.py", line 110, in __init__
    self.initRuleset()
  File "/hdd/pub/src/gitgames/kajongg/src/scoringengine.py", line 167, in initRuleset
    raise Exception(u'just one unicode char:ä')
exceptions.Exception: Exception(u'just one unicode char:\xe4',)
fail: <twisted.spread.pb.CopyableFailure <type 'exceptions.Exception'>>
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 515, in expressionReceived
    method(*sexp[1:])
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 827, in proto_message
    self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 865, in _recvMessage
    callbackArgs=args, errbackArgs=args)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 286, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 542, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 896, in _sendFailureOrError
    self._sendFailure(fail, requestID)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 905, in _sendFailure
    self._sendError(fail, requestID)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 921, in _sendError
    self.sendCall("error", requestID, self.serialize(fail))
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 764, in serialize
    return jelly(object, self.security, None, self)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/jelly.py", line 1122, in jelly
    return _Jellier(taster, persistentStore, invoker).jelly(object)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/jelly.py", line 475, in jelly
    return obj.jellyFor(self)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/flavors.py", line 299, in jellyFor
    state = self.getStateToCopyFor(p)
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/flavors.py", line 267, in getStateToCopyFor
    return self.getStateToCopy()
  File "/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg/twisted/spread/pb.py", line 407, in getStateToCopy
    state['value'] = str(self.value) # Exception instance
exceptions.UnicodeEncodeError: UnicodeEncodeError('ascii', u'just one unicode char:\xe4', 22, 23, 'ordinal not in range(128)')


-- 
Wolfgang



More information about the Twisted-Python mailing list