[Twisted-Python] twisted reactor under win32 (test SerialPort)

Zhe Hu iammegatron at gmail.com
Mon Sep 29 16:11:33 MDT 2008

Hi,I try to use twisted for asynchronous serial port read().

Here is my simple twisted code:
from twisted.internet import reactor
from twisted.internet.serialport import SerialPort
from twisted.internet.protocol import Protocol

class Client(Protocol):
    def connectionMade(self):
        print 'connected'

    def dataReceived(self, data):
        print data

SerialPort(Client(), 'COM4', reactor)
reactor.callLater(20, reactor.stop())


It runs on my Mac with this line changed to SerialPort(Client,
'dev/tty.usbserial-A4001mLL', reactor) which is my Arduino board device.

But on Windows XP, it gave the error message:
"AttributeError: 'module' object has no attribute 'addEvent' "

I tried to used different reactor, such as selectreactor, win32eventreactor,
but the error message became "AssertionError: reactor already installed"

Please help. Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20080929/d1f0cd60/attachment.html>

More information about the Twisted-Python mailing list