[Twisted-Python] unhandled error in example pb_client.py
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? -- Wolfgang ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] [Twisted-commits] r33889 - Merge elementresource-5395: Add renderElement, for rendering Elements.
On Mar 18, 2012, at 9:44 AM, exar...@twistedmatrix.com wrote: On 02:20 am, gl...@twistedmatrix.com wrote: On Mar 17, 2012, at 7:53 AM, Itamar Turner-Trauring wrote: On 03/16/2012 10:51 PM, dr...@wolfwood.twistedmatrix.com wrote: Author: dreid Date: Fri Mar 16 20:51:46 2012 New Revision: 33889 Added: trunk/twisted/web/topfiles/5395.feature - copied unchanged from r33888, /branches/elementresource-5395/twisted/web/topfiles/5395.feature Modified: trunk/twisted/web/template.py trunk/twisted/web/test/test_template.py I notice no documentation was added. Perhaps we should start requiring documentation updates for all new features? Before the ticket was closed, a separate ticket was filed for documentation: http://twistedmatrix.com/trac/ticket/4983. I don't think that adding a hard requirement for documentation on every new thing as a prerequisite is necessarily a good idea (especially if a new contributor wants to add a feature, this adds to an already substantial burden), but someone should ask a question about documentation on any ticket that doesn't explicitly account for it, very early in the process. The way I feel about documentation now makes me read this much as I would read a different response to a different question. You should be able to guess the question from my imagined response: I don't think that adding a hard requirement for unit tests on every new thing as a prerequisite is necessarily a good idea (especially if a new contributor wants to add a feature, this adds to an already substantial burden), but someone should ask a question about unit tests on any ticket that doesn't explicitly account for them, very early in the process. Yes, yes, how droll :-P. As usual, I can't prove that writing documentation at the same time (or before) an implementation actually produces better results, but I can say that this is increasingly my opinion from my personal experience. *Even* if requiring documentation cut feature contribution by half, I think it'd be worthwhile. Some number of features, undocumented, are worth less than half as many with good documentation. Actually I agree with that. What we need is not more contributions, but more contributors (especially, more qualified reviewers). I have the vague sense (which I also can't prove) that contributors stick around more often if they are able to successfully contribute something, and needing to become familiar with a new documentation toolchain in addition to a new testing toolchain is an impediment to that. The flip side of that is that more contributors will probably show up in the first place if the documentation is better. So I am somewhat ambivalent and am easily swayed by the argument that we already do apparently require it. Still, I think we should try to bring it up as early as possible in the review process, and have better docs on how to author docs. Plus, note that it was not a new contributor who finished this particular ticket. ;) Re-attracting idle contributors has even more appeal, as maybe they'll remember how to review tickets :). Also, note that http://twistedmatrix.com/trac/wiki/ReviewProcess already says, as Things your branch must contain: Appropriate new or modified End User guide documentation (in the form of Lore-formatted xhtml files in the doc/ directory) So essentially we do require this already, but reviewers seem to largely ignore it (so even if we decide this should not be a requirement, reviewers are not doing their job properly, and that's another issue we should address). Jean-Paul Looks like some guy named exarkun was the passing reviewer on the ticket in question, maybe you should talk to him ;-). -glyph ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] unhandled error in example pb_client.py
On Mar 19, 2012, at 3:30 AM, Wolfgang Rohdewald wrote: 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? all errors is a pretty broad category, so you'd have to do a whole bunch of things :). The type of errors you're talking about are client connection errors. The quickest way to catch those is to make your own subclass of PBClientFactory and implement clientConnectionFailed, which will be called each time there is an error in initially setting up a connection. 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. That sounds like a bug in QT, a bug in QT4reactor, or perhaps just the general problem that modal dialog boxes with a blocking API are an inherently bad idea. Without more detail though it's impossible to say what your problem really is. My guess, though, would be to find a modal-dialog-box API that doesn't block or enter a reentrant main loop. 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? Because DNS lookup failed and address %r not found are strings from Twisted, not from your operating system. Twisted does not have any localizations, unfortunately. Localizing all its error messages would be a major project, and a challenging one, as class names appear quite frequently in such messages and their names (such as Failure) are all in english. If you were interested in starting to localize Twisted though, I would definitely be interested to hear your thoughts on how it might be done. -glyph ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python