Magnus Henoch <[EMAIL PROTECTED]> writes:
> One of our users can't login to MSN with PyMSN 0.9.3. The log says
> this:
>
> 05/24/05 - 20:39:05 - MSNConnection: "[EMAIL PROTECTED]" initialised
> 05/24/05 - 20:39:10 - LegacyConnection: "[EMAIL PROTECTED]" - loggedIn()
> 05/24/05 - 20:39:10 - NotificationClient: "[EMAIL PROTECTED]" authenticated
> with MSN servers
> 05/24/05 - 20:39:10 - Traceback (most recent call last):
> 05/24/05 - 20:39:10 - File
> "/usr/local/lib/python2.3/site-packages/twisted/internet/default.py", line
> 526, in doSelect
> 05/24/05 - 20:39:10 - _logrun(selectable, _drdw, selectable, method, dict)
> 05/24/05 - 20:39:10 - File
> "/usr/local/lib/python2.3/site-packages/twisted/python/log.py", line 65, in
> callWithLogger
> 05/24/05 - 20:39:10 - callWithContext({"system": lp}, func, *args, **kw)
> 05/24/05 - 20:39:10 - File
> "/usr/local/lib/python2.3/site-packages/twisted/python/log.py", line 52, in
> callWithContext
> 05/24/05 - 20:39:10 - return context.call({ILogContext: newCtx}, func,
> *args, **kw)
> 05/24/05 - 20:39:11 - File
> "/usr/local/lib/python2.3/site-packages/twisted/python/context.py", line 43,
> in callWithContext
> 05/24/05 - 20:39:11 - return func(*args,**kw)
> 05/24/05 - 20:39:11 - --- <exception caught here> ---
> 05/24/05 - 20:39:11 - File
> "/usr/local/lib/python2.3/site-packages/twisted/internet/default.py", line
> 535, in _doReadOrWrite
> 05/24/05 - 20:39:11 - why = getattr(selectable, method)()
> 05/24/05 - 20:39:11 - File
> "/usr/local/lib/python2.3/site-packages/twisted/internet/tcp.py", line 255,
> in doRead
> 05/24/05 - 20:39:11 - return self.protocol.dataReceived(data)
> 05/24/05 - 20:39:11 - File
> "/usr/local/lib/python2.3/site-packages/twisted/protocols/basic.py", line
> 223, in dataReceived
> 05/24/05 - 20:39:11 - why = self.lineReceived(line)
> 05/24/05 - 20:39:11 - File "/jabber/src/PyMSNt-0.9.3/src/tlib/msn.py", line
> 652, in lineReceived
> 05/24/05 - 20:39:11 - try: handler(params.split())
> 05/24/05 - 20:39:11 - File "/jabber/src/PyMSNt-0.9.3/src/tlib/msn.py", line
> 884, in handle_LST
> 05/24/05 - 20:39:11 - lists=int(params[2]))
> 05/24/05 - 20:39:11 - exceptions.ValueError: invalid literal for int():
> .]%20Pansarbaskern%20i%20 go
> 05/24/05 - 20:39:11 - NotificationClient: "[EMAIL PROTECTED]" lost connection
> with MSN servers
I finally got around to debugging this. The MSN server is sending the
character '\x80' as part of the nickname, which Python's string.split
interprets as whitespace. The following patch seems to fix the
problem:
--- ../../PyMSNt-0.9.3/src/tlib/msn.py Fri May 13 16:01:34 2005
+++ src/tlib/msn.py Wed Jul 27 13:10:29 2005
@@ -649,10 +649,10 @@
handler = getattr(self, "handle_%s" % cmd.upper(), None)
if handler:
- try: handler(params.split())
+ try: handler(params.split(' '))
except MSNProtocolError, why: self.gotBadLine(line, why)
else:
- self.handle_UNKNOWN(cmd, params.split())
+ self.handle_UNKNOWN(cmd, params.split(' '))
def rawDataReceived(self, data):
extra = ""
The patch assumes that space is the only valid delimiter for
parameters. Is that true?
Are there other places where the same change needs to be done?
Can this make it into PyMSN-t 0.9.4?
Magnus