I am trying to write a client in python 2.7 using Twisted. My code works fine on linux (debian squeeze), but when I tried it on windows (xp and 7), I got a constant stream of error messages. A screenshot of these messages is here .
I narrowed down the error and was able to write a very stripped-down version of my client that still contains the error:
from twisted.internet.protocol import Protocol,ClientFactory from twisted.protocols.basic import LineReceiver from twisted.internet import reactor class TheClient(LineReceiver): def lineReceived(self,line): print line def connectionLost(self,reason): reactor.stop() class TheFactory(ClientFactory): protocol = TheClient class Test(object): def doRead(self): pass def fileno(self): return 0 def connectionLost(self,reason): print 'connection lost' def logPrefix(self): return 'Client' def main(): print 'starting' test = Test() reactor.addReader(test) reactor.run() if __name__ == '__main__': main()
If the line containing 'reactor.addReader (test)' is commented out, I do not receive any error messages. If I run this code on Linux without commenting on any lines, I do not receive any error messages.
I found this question , I do not think its the same problem, but, as expected, it did not function properly in the windows.
Is this code correct and is it a bug in Windows, or do I need to do something different to work in windows?
source share