From: Norman R. <no...@ra...> - 2011-11-09 12:35:23
|
Try changing line 19 from: sys.stdout.write(event.getBody() + '\n') to sys.stdout.write('%s\n' % event.getBody()) On Tue, Aug 23, 2011 at 6:13 AM, Nilanjan Banerjee <nil...@gm...>wrote: > Hi, > > I am trying the example xtalk.py with Facebook. Its working sometimes, > but the connection is frequently breaking down due to the receipt of some > "None" value from Facebook. I noticed that most of the times this happens > when I try to send some chat message from Facebook to the xtalk > application, but it does happen even spontaneously sometimes. The debugger > output listed below shows one such spontaneous instance - the Hello message > from the xtalk application reaches Facebook, but the application crashes > immediately after that. Not sure if the id->None has anything to do with > the error in this case. In other cases, when the error occurs on sending a > message from Facebook, I have tried printing the event.getBody() with > sys.stderr.write(str(event.getBody()) + '\n') and found that the value > printed is "None". Would appreciate if anybody can throw some light on what > is happening over here. Thanks in advance. > > Nil. > > > authenticated using sasl > DEBUG: dispatcher info Registering handler <bound method > Bot.xmpp_message of <__main__.Bot instance at 0x1c848710>> for "message" > type-> ns->(jabber:client) > Hello > DEBUG: socket sent <message to="-10...@ch..." > type="chat" id="3"> > <body>Hello</body> > </message> > DEBUG: socket got <iq from="chat.facebook.com" to=" > xxx...@ch.../73b32809_4AB24E970A5D0" id="fbiq4AB24EB977DE5" > type="set"> > <own-message xmlns="http://www.facebook.com/xmpp/messages" to="- > 100...@ch..." self="true"> > <body>Hello</body> > </own-message> > </iq> > DEBUG: nodebuilder down DEPTH -> 2 , tag -> iq, attrs -> {u'to': > u'xxx...@ch.../73b32809_4AB24E970A5D0', u'from': u' > chat.facebook.com', u'id': u'fbiq4AB24EB977DE5', u'type': u'set'} > DEBUG: nodebuilder down DEPTH -> 3 , tag -> own-message, attrs -> > {u'to': u'-10...@ch...', u'self': u'true', > u'xmlns': u'http://www.facebook.com/xmpp/messages'} > DEBUG: nodebuilder down DEPTH -> 4 , tag -> body, attrs -> {} > DEBUG: nodebuilder data Hello > DEBUG: nodebuilder up DEPTH -> 4 , tag -> body > DEBUG: nodebuilder up DEPTH -> 3 , tag -> own-message > DEBUG: nodebuilder up DEPTH -> 2 , tag -> iq > DEBUG: dispatcher ok Got jabber:client/iq stanza > DEBUG: dispatcher ok Dispatching iq stanza with type->set props->[u' > http://www.facebook.com/xmpp/messages'] id->fbiq4AB24EB977DE5 > DEBUG: socket sent <iq to="chat.facebook.com" from=" > car...@ch.../73b32809_4AB24E970A5D0" id="fbiq4AB24EB977DE5" > type="error"> > <own-message to="-10...@ch..." self="true" xmlns=" > http://www.facebook.com/xmpp/messages"> > <body>Hello</body> > </own-message> > <error code="501" type="cancel"> > <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> > <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">The feature requested > is not implemented by the recipient or server and therefore cannot be > processed.</text> > </error> > </iq> > DEBUG: socket got <message from="- > 100...@ch..." to=" > xxx...@ch.../73b32809_4AB24E970A5D0" type="chat"> > <composing xmlns="http://jabber.org/protocol/chatstates"/> > </message> > DEBUG: nodebuilder down DEPTH -> 2 , tag -> message, attrs -> {u'to': > u'xxx...@ch.../73b32809_4AB24E970A5D0', u'from': > u'-10...@ch...', u'type': u'chat'} > DEBUG: nodebuilder down DEPTH -> 3 , tag -> composing, attrs -> > {u'xmlns': u'http://jabber.org/protocol/chatstates'} > DEBUG: nodebuilder up DEPTH -> 3 , tag -> composing > DEBUG: nodebuilder up DEPTH -> 2 , tag -> message > DEBUG: dispatcher ok Got jabber:client/message stanza > DEBUG: dispatcher ok Dispatching message stanza with type->chat > props->[u'http://jabber.org/protocol/chatstates'] id->None > Traceback (most recent call last): > File "./xtalk.py", line 77, in ? > cl.Process(1) > File "/root/fbgwpy/xmpp/dispatcher.py", line 303, in dispatch > File "./xtalk.py", line 19, in xmpp_message > sys.stdout.write(event.getBody() + '\n') > TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' > > > > ------------------------------------------------------------------------------ > Get a FREE DOWNLOAD! and learn more about uberSVN rich system, > user administration capabilities and model configuration. Take > the hassle out of deploying and managing Subversion and the > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 > > _______________________________________________ > Xmpppy-devel mailing list > Xmp...@li... > https://lists.sourceforge.net/lists/listinfo/xmpppy-devel > > -- - Norman Rasmussen - Email: no...@ra... - Home page: http://norman.rasmussen.co.za/ |