2009-08-07 6 views
3

私はここにあるツイストドキュメントからtwisted.wordsのMSNプロトコルの例を実行しているから、このトレースバックを理解させますこれはまったく別の問題です。このサンプルを実行すると、期待どおりの動作をします。アカウントにログインし、buddylist上のユーザーに関する情報を表示しますが、それは私はtwisted.wordsのMSNサンプル

> Traceback (most recent call last): 
> File 
> "c:\python26\lib\site-packages\twisted\python\log.py", 
> line 84, in callWithLogger 
>  return callWithContext({"system": lp}, func, *args, **kw) File 
> "c:\python26\lib\site-packages\twisted\python\log.py", 
> line 69, in callWithContext 
>  return context.call({ILogContext: newCtx}, func, *args, **kw) File 
> "c:\python26\lib\site-packages\twisted\python\context.py", 
> line 59, in callWithContext 
>  return self.currentContext().callWithContext(ctx, 
> func, *args, **kw) File 
> "c:\python26\lib\site-packages\twisted\python\context.py", 
> line 37, in callWithContext 
>  return func(*args,**kw) 
> --- <exception caught here> --- File "c:\python26\lib\site-packages\twisted\internet\selectreactor.py", 
> line 146, in _doReadOrWrite 
>  why = getattr(selectable, method)() File 
> "c:\python26\lib\site-packages\twisted\internet\tcp.py", 
> line 463, in doRead 
>  return self.protocol.dataReceived(data) 
> File 
> "c:\python26\lib\site-packages\twisted\protocols\basic.py", line 239, indataReceived 
>  return self.rawDataReceived(data) File 
> "c:\python26\lib\site-packages\twisted\words\protocols\msn.py", 
> line 676 in rawDataReceived 
>  self.gotMessage(m) File "c:\python26\lib\site-packages\twisted\words\protocols\msn.py", 
> line 699, in gotMessage 
>  raise NotImplementedError exceptions.NotImplementedError: 

このトレースバックを吐くことを行わした後、誰かが私はそれが何を意味するのか理解するのに役立つだろうか?

答えて

0

メソッドgotMessageは実装されていないと主張します。これは、サブクラスでgotMessageをオーバーライドする必要があるクラスをサブクラス化したが、オーバーライドしていないことを意味します。

+0

このコードは、ねじれた単語の文書から完全なコピー貼り付けです。これはmsnプロトコルの変更と関係がありますか?それとも、私は依存ライブラリやそのようなものがないのでしょうか? – Ryan

+0

これはねじれた部分のAPIの変化のようですが、私はそれに精通していないので分かりません。 –

1

MSNサーバーの操作方法は変更されているようですが、実際にはプロトコルの変更とは見なされません。何が起こっているのは、クライアントが接続した直後にMSNサーバがクライアントにメッセージを送信していることで、Twistedワードの例ではそれが期待できません。

あなたはhttp://twistedmatrix.com/projects/words/documentation/examples/からmsn_example.pyを実行していると仮定すると、あなたは、実施例を取得し、例に次のコードを追加することで何が起こっているかを見ることができます(右listSynchronized機能の終了後):

def gotMessage(self, message): 
    print message.headers 
    print message.getMessage() 
私たちは、サーバがクライアントに未読メールメッセージの数を指定するメッセージを送信しているためにそこにあることがわかります

... 
2009-08-25 00:03:23-0700 [Notification,client] {'Content-Type': 'text/x-msmsgsinitialemailnotification; charset=UTF-8', 'MIME-Version': '1.0'} 
2009-08-25 00:03:23-0700 [Notification,client] Inbox-Unread: 1 
2009-08-25 00:03:23-0700 [Notification,client] Folders-Unread: 0 
2009-08-25 00:03:23-0700 [Notification,client] Inbox-URL: /cgi-bin/HoTMaiL 
2009-08-25 00:03:23-0700 [Notification,client] Folders-URL: /cgi-bin/folders 
2009-08-25 00:03:23-0700 [Notification,client] Post-URL: http://www.hotmail.com 
2009-08-25 00:03:23-0700 [Notification,client] 

:変更を行った後、あなたが例を実行した場合、あなたは次のように表示されるはず

そのアカウント。

希望に役立ちます!

関連する問題