Hello.

I'd like to share with whoever interested, that to get rid of endless
backtraces inside pyicqt log, that look like this:

[2007-11-29 14:07:19] Traceback (most recent call last):
          File "/usr/share/pyicqt/src/tlib/oscar.py", line 648, in dataReceived
            state=func(flap)
          File "/usr/share/pyicqt/src/tlib/oscar.py", line 757, in oscar_Data
            d.callback(snac)
          File "/usr/lib/python2.4/site-packages/twisted/internet/defer.py", 
line 229, in callback
            self._startRunCallbacks(result)
          File "/usr/lib/python2.4/site-packages/twisted/internet/defer.py", 
line 294, in _startRunCallbacks
            self._runCallbacks()
        --- <exception caught here> ---
          File "/usr/lib/python2.4/site-packages/twisted/internet/defer.py", 
line 307, in _runCallbacks
            self.result = callback(self.result, *args, **kw)
          File "/usr/share/pyicqt/src/legacy/icqt.py", line 330, in 
sendAwayPresence
            LogEvent(INFO, self.session.jabberID, "Away (%s, %s) message %s" % 
(charset, msg[0], status))
        exceptions.UnicodeDecodeError: 'utf8' codec can't decode bytes in 
position 21-22: invalid data

the following patch/workaround may be used:

--- /usr/share/pyicqt/src/legacy/icqt.py.orig   2007-11-29 14:33:39.000000000 
+0300
+++ /usr/share/pyicqt/src/legacy/icqt.py        2007-11-29 15:30:42.000000000 
+0300
@@ -327,7 +327,10 @@
                                        status = msg[0] + ": " + status

                        status = status.decode(charset, 'replace')
-                       LogEvent(INFO, self.session.jabberID, "Away (%s, %s) 
message %s" % (charset, msg[0], status))
+                       try:
+                               LogEvent(INFO, self.session.jabberID, "Away 
(%s, %s) message %s" % (charset, msg[0], status))
+                       except UnicodeDecodeError:
+                               LogEvent(INFO, self.session.jabberID, "Away 
(%s, %s) message %s" % (charset, unicode(msg[0], config.encoding), status))

                if status == "Away" or status=="I am currently away from the 
computer." or status=="I am away from my computer right now.":
                        status = ""
_______________________________________________
py-transports mailing list
py-transports@blathersource.org
http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports

Reply via email to