[Twisted-Python] unhandled error in example pb_client.py

Wolfgang Rohdewald wolfgang at rohdewald.de
Mon Mar 19 03:30:47 EDT 2012

this is twisted 11.0.0 on kubuntu 11.10

if I call

cd /usr/share/doc/python-twisted-words/examples/pb_client.py
python pb_client.py fdfdasfdfdas.com 1000 a b c

I am getting an unhandled error. Same for servers not answering
or rejecting.

how would I have to modify pb_client if I want to catch and
handle all errors?

my real-world problem is more complicated: In case of error I
show a modal Qt4 message box. This gives me interactions between
twisted and qt4reactor leading to infinite recursion. I can fix that
for DNS lookup failure and not answering servers by temporarily
disabling qt4reactor, but for rejecting servers I cannot get rid
of the unhandled error. But before tackling that, I want to 
understand how I can really catch and handle all errors.

when that works I will have one more problem: I my case
I have
class myClient(pb.PBClientFactory):
    def clientConnectionFailed(self, connector, reason):
        """connection from client to server failed"""
        print 'getErrorMessage:', repr(reason.getErrorMessage())

which gives me
"DNS lookup failed: address u'fdksfsfa0s0f.com' not found: [Errno -5] Zu 
diesem Hostnamen geh\xc3\xb6rt keine Adresse."

so it is translated to German. But pb_client.py returns english messages
if I insert and use myClient. $LANG is the same for both: de_DE.UTF-8
so why does pb_client not translate the message?


More information about the Twisted-Python mailing list