[Twisted-Python] serial port error

Eric C. Newton ecn at metaslash.com
Sat Apr 12 10:29:30 EDT 2003

I tried to write to a serial port today, and Twisted didn't do so well.
"AttributeError: SerialPort instance has no attribute 'unsent'"

Linux Red Hat 9
Twisted (from CVS at 5:30 AM EDT)

    from twisted.protocols.basic import LineReceiver
    from twisted.internet.serialport import SerialPort
    from twisted.internet import reactor

    class Test(LineReceiver):
	def connectionMade(self):
	    self.transport.write('Hello World!\n')
    SerialPort(Test(), '/dev/ttyS0', reactor)

      File "test.py", line 10, in ?
	SerialPort(Test(), '/dev/ttyS0', reactor)
      File "/usr/lib/python2.2/site-packages/twisted/internet/serialport/posixserialport.py", line 49, in __init__
      File "/usr/lib/python2.2/site-packages/twisted/internet/protocol.py", line 290, in makeConnection
      File "test.py", line 8, in connectionMade
	self.transport.write('Hello World!\n')
      File "/usr/lib/python2.2/site-packages/twisted/internet/abstract.py", line 145, in write
	l = self.writeSomeData(data)
      File "/usr/lib/python2.2/site-packages/twisted/internet/serialport/posixserialport.py", line 59, in writeSomeData
	return os.write(self.fileno(), self.unsent)
    AttributeError: SerialPort instance has no attribute 'unsent'


More information about the Twisted-Python mailing list