1
我學習扭曲的,這裏是我的第一個服務器的例子:AttributeError的:EchoFactory實例沒有屬性「DOSTART」
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Protocol):
def buildProtocal(self, addr):
return Echo()
reactor.listenTCP(8000, EchoFactory())
reactor.run()
而且我得到了這個錯誤,我試圖重新安裝庫,但它仍然沒「T工作:
Traceback (most recent call last):
File "/home/trieu/Desktop/server.py", line 11, in <module>
reactor.listenTCP(8000, EchoFactory())
File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py",
line 495, in listenTCP
p.startListening()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 998,
in startListening
self.factory.doStart()
AttributeError: EchoFactory instance has no attribute 'doStart'