2005年08月18日 星期四 15:37
我想从POP3服务器上得到email的信息,以面的程序出错。 from __future__ import generators from twisted.internet.defer import deferredGenerator as dg, waitForDeferred as wfd from twisted.internet import protocol, reactor from twisted.mail import pop3 class MyPOP3Client(pop3.AdvancedPOP3Client): def connectionMade(self): pop3.AdvancedPOP3Client.connectionMade(self) d = wfd(self.login('leojay, '123')) yield d print d.getResult() d = wfd(self.listSize()) yield d print d.getResult() def connectionLost(self, reason): print reason reactor.stop() def main(): f = protocol.ClientFactory() f.protocol = MyPOP3Client reactor.connectTCP('localhost', 110, f) reactor.run() if __name__ == '__main__': main() 出错信息为: Traceback (most recent call last): File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", line 56, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", line 41, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", line 52, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", line 31, in callWithContext return func(*args,**kw) ------ File "D:\Python\Python24\Lib\site-packages\twisted\internet\selectreactor.py", line 139, in _doReadOrWrite why = getattr(selectable, method)() File "D:\Python\Python24\Lib\site-packages\twisted\internet\tcp.py", line 351, in doRead return self.protocol.dataReceived(data) File "D:\Python\Python24\Lib\site-packages\twisted\protocols\basic.py", line 149, in dataReceived self.lineReceived(line) File "D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py", line 190, in lineReceived state = self.state exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' [Failure instance: Traceback (failure with no frames): exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' ] 请问,正确的twisted.mail.pop3.AdvancedPOP3Client的用法是什么?我的方法不对吗? -- Best Regards, Leo Jay
2005年08月19日 星期五 10:27
没有人要理我吗? 麻烦哪位帮帮我呀。 谢谢了 -- Best Regards, Leo Jay
2005年08月19日 星期五 10:39
建议你提出详细具体的问题,如果你是想让人告诉你源代码,请到 google试看看你的运气。 在 05-8-19,Leo Jay<python.leojay at gmail.com> 写道: > 没有人要理我吗? > > 麻烦哪位帮帮我呀。 > 谢谢了 > > -- > Best Regards, > Leo Jay > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- 梅劲松
2005年08月19日 星期五 13:12
我写了呀,你没收到吗? 这是我昨天下午发到mailing list的email: On 8/18/05, Leo Jay <python.leojay at gmail.com> wrote: > 我想从POP3服务器上得到email的信息,以面的程序出错。 > > from __future__ import generators > > from twisted.internet.defer import deferredGenerator as dg, > waitForDeferred as wfd > from twisted.internet import protocol, reactor > from twisted.mail import pop3 > > class MyPOP3Client(pop3.AdvancedPOP3Client): > > def connectionMade(self): > pop3.AdvancedPOP3Client.connectionMade(self) > d = wfd(self.login('leojay, '123')) > yield d > print d.getResult() > > d = wfd(self.listSize()) > yield d > print d.getResult() > > def connectionLost(self, reason): > print reason > reactor.stop() > > > def main(): > f = protocol.ClientFactory() > f.protocol = MyPOP3Client > reactor.connectTCP('localhost', 110, f) > reactor.run() > > if __name__ == '__main__': > main() > > > 出错信息为: > Traceback (most recent call last): > File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", > line 56, in callWithLogger > return callWithContext({"system": lp}, func, *args, **kw) > File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", > line 41, in callWithContext > return context.call({ILogContext: newCtx}, func, *args, **kw) > File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", > line 52, in callWithContext > return self.currentContext().callWithContext(ctx, func, *args, **kw) > File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", > line 31, in callWithContext > return func(*args,**kw) > ------ > File "D:\Python\Python24\Lib\site-packages\twisted\internet\selectreactor.py", > line 139, in _doReadOrWrite > why = getattr(selectable, method)() > File "D:\Python\Python24\Lib\site-packages\twisted\internet\tcp.py", > line 351, in doRead > return self.protocol.dataReceived(data) > File "D:\Python\Python24\Lib\site-packages\twisted\protocols\basic.py", > line 149, in dataReceived > self.lineReceived(line) > File "D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py", > line 190, in lineReceived > state = self.state > exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' > [Failure instance: Traceback (failure with no frames): > exceptions.AttributeError: MyPOP3Client instance has no attribute > 'state' > ] > > 请问,正确的twisted.mail.pop3.AdvancedPOP3Client的用法是什么?我的方法不对吗? > > -- > Best Regards, > Leo Jay > On 8/19/05, 梅劲松 <stephen.cn at gmail.com> wrote: > 建议你提出详细具体的问题,如果你是想让人告诉你源代码,请到 google试看看你的运气。 -- Best Regards, Leo Jay
2005年08月19日 星期五 13:41
state在哪里没看到,是你的pop3client.py的问题, 在 05-8-19,Leo Jay<python.leojay at gmail.com> 写道: > 我写了呀,你没收到吗? > > 这是我昨天下午发到mailing list的email: > On 8/18/05, Leo Jay <python.leojay at gmail.com> wrote: > > 我想从POP3服务器上得到email的信息,以面的程序出错。 > > > > from __future__ import generators > > > > from twisted.internet.defer import deferredGenerator as dg, > > waitForDeferred as wfd > > from twisted.internet import protocol, reactor > > from twisted.mail import pop3 > > > > class MyPOP3Client(pop3.AdvancedPOP3Client): > > > > def connectionMade(self): > > pop3.AdvancedPOP3Client.connectionMade(self) > > d = wfd(self.login('leojay, '123')) > > yield d > > print d.getResult() > > > > d = wfd(self.listSize()) > > yield d > > print d.getResult() > > > > def connectionLost(self, reason): > > print reason > > reactor.stop() > > > > > > def main(): > > f = protocol.ClientFactory() > > f.protocol = MyPOP3Client > > reactor.connectTCP('localhost', 110, f) > > reactor.run() > > > > if __name__ == '__main__': > > main() > > > > > > 出错信息为: > > Traceback (most recent call last): > > File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", > > line 56, in callWithLogger > > return callWithContext({"system": lp}, func, *args, **kw) > > File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", > > line 41, in callWithContext > > return context.call({ILogContext: newCtx}, func, *args, **kw) > > File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", > > line 52, in callWithContext > > return self.currentContext().callWithContext(ctx, func, *args, **kw) > > File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", > > line 31, in callWithContext > > return func(*args,**kw) > > ------ > > File "D:\Python\Python24\Lib\site-packages\twisted\internet\selectreactor.py", > > line 139, in _doReadOrWrite > > why = getattr(selectable, method)() > > File "D:\Python\Python24\Lib\site-packages\twisted\internet\tcp.py", > > line 351, in doRead > > return self.protocol.dataReceived(data) > > File "D:\Python\Python24\Lib\site-packages\twisted\protocols\basic.py", > > line 149, in dataReceived > > self.lineReceived(line) > > File "D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py", > > line 190, in lineReceived > > state = self.state > > exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' > > [Failure instance: Traceback (failure with no frames): > > exceptions.AttributeError: MyPOP3Client instance has no attribute > > 'state' > > ] > > > > 请问,正确的twisted.mail.pop3.AdvancedPOP3Client的用法是什么?我的方法不对吗? > > > > -- > > Best Regards, > > Leo Jay > > > > > On 8/19/05, 梅劲松 <stephen.cn at gmail.com> wrote: > > 建议你提出详细具体的问题,如果你是想让人告诉你源代码,请到 google试看看你的运气。 > > -- > Best Regards, > Leo Jay > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- 梅劲松
2005年08月19日 星期五 14:39
On 8/19/05, 梅劲松 <stephen.cn at gmail.com> wrote: > state在哪里没看到,是你的pop3client.py的问题, > 我的pop3client.py的问题? 你是说我要重新装一遍twisted? -- Best Regards, Leo Jay
2005年08月21日 星期日 13:59
看到有个state的属性错误. 在 05-8-19,Leo Jay<python.leojay at gmail.com> 写道: > On 8/19/05, 梅劲松 <stephen.cn at gmail.com> wrote: > > state在哪里没看到,是你的pop3client.py的问题, > > > > 我的pop3client.py的问题? > 你是说我要重新装一遍twisted? > > -- > Best Regards, > Leo Jay > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- 梅劲松
2005年08月21日 星期日 20:13
D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py是twisted自带的呀。不管我的事呀。 我重装了twisted也不行,还是一样的。 :( 是我的程序的问题吗? 源代码如下: from __future__ import generators from twisted.internet.defer import deferredGenerator as dg, waitForDeferred as wfd from twisted.internet import protocol, reactor from twisted.mail import pop3 class MyPOP3Client(pop3.AdvancedPOP3Client): def connectionMade(self): d = wfd(self.login('leojay at leojay.com', '353')) yield d print d.getResult() d = wfd(self.listSize()) yield d print d.getResult() def connectionLost(self, reason): print reason reactor.stop() def main(): f = protocol.ClientFactory() f.protocol = MyPOP3Client reactor.connectTCP('localhost', 110, f) reactor.run() if __name__ == '__main__': main() On 8/21/05, 梅劲松 <stephen.cn at gmail.com> wrote: > 看到有个state的属性错误. > -- Best Regards, Leo Jay
2005年08月22日 星期一 11:24
你的程序在import的时候就报告,本来想帮你看一下的。 Traceback (most recent call last): File "C:\Documents and Settings\stephen\桌面\mail.py", line 2, in ? from twisted.internet.defer import deferredGenerator as dg,waitForDeferred as wfd ImportError: cannot import name deferredGenerator 在 05-8-21,Leo Jay<python.leojay at gmail.com> 写道: > D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py是twisted自带的呀。不管我的事呀。 > > 我重装了twisted也不行,还是一样的。 :( > 是我的程序的问题吗? > > 源代码如下: > > from __future__ import generators > > from twisted.internet.defer import deferredGenerator as dg, > waitForDeferred as wfd > from twisted.internet import protocol, reactor > from twisted.mail import pop3 > > class MyPOP3Client(pop3.AdvancedPOP3Client): > > def connectionMade(self): > d = wfd(self.login('leojay at leojay.com', '353')) > yield d > print d.getResult() > > d = wfd(self.listSize()) > yield d > print d.getResult() > > def connectionLost(self, reason): > print reason > reactor.stop() > > > def main(): > f = protocol.ClientFactory() > f.protocol = MyPOP3Client > reactor.connectTCP('localhost', 110, f) > reactor.run() > > if __name__ == '__main__': > main() > > > > > On 8/21/05, 梅劲松 <stephen.cn at gmail.com> wrote: > > 看到有个state的属性错误. > > > > -- > Best Regards, > Leo Jay > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- 梅劲松
2005年08月22日 星期一 11:33
你的是什么版本的twisted?我的是2.0.1版本的。 我出的错是: Traceback (most recent call last): File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", line 56, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\log.py", line 41, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", line 52, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "D:\Python\Python24\Lib\site-packages\twisted\python\context.py", line 31, in callWithContext return func(*args,**kw) ------ File "D:\Python\Python24\Lib\site-packages\twisted\internet\selectreactor.py", line 139, in _doReadOrWrite why = getattr(selectable, method)() File "D:\Python\Python24\Lib\site-packages\twisted\internet\tcp.py", line 351, in doRead return self.protocol.dataReceived(data) File "D:\Python\Python24\Lib\site-packages\twisted\protocols\basic.py", line 149, in dataReceived self.lineReceived(line) File "D:\Python\Python24\Lib\site-packages\twisted\mail\pop3client.py", line 190, in lineReceived state = self.state exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' [Failure instance: Traceback (failure with no frames): exceptions.AttributeError: MyPOP3Client instance has no attribute 'state' ] On 8/22/05, 梅劲松 <stephen.cn at gmail.com> wrote: > 你的程序在import的时候就报告,本来想帮你看一下的。 > > > Traceback (most recent call last): > File "C:\Documents and Settings\stephen\桌面\mail.py", line 2, in ? > from twisted.internet.defer import deferredGenerator as > dg,waitForDeferred as wfd > ImportError: cannot import name deferredGenerator > > -- Best Regards, Leo Jay
Zeuux © 2025
京ICP备05028076号