2009-08-07 4 views
3

내가 여기에있는 트위스트 문서에서 twisted.words의 MSN 프로토콜의 예를 실행 해요에서이 역 추적을 이해하도록 돕는다 stackoverflow에,하지만 이것은 완전히 다른 문제입니다. 예제를 실행하면 예상대로 작동합니다. 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 서버가 클라이언트가 연결 한 직후 클라이언트에게 메시지를 보내고 트위스티드 단어 예제가 그것을 기대하지 않는다는 것입니다.

당신이 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] 

우리는 서버가 클라이언트에게 거기에있는 읽지 않은 전자 메일 메시지의 수를 지정하는 메시지를 전송하고 있음을 볼 수있다 그 계정.

희망 하시겠습니까?