[Twisted-Python] SerialPort.loseConnection() BUG Still

Nestor A. Diaz nestor at tiendalinux.com
Tue Jun 16 13:37:52 EDT 2009


Hello, i had wrapper the loseConnection method, but it still throws the 
same excepcion:

class MySerialPort ( SerialPort ) :

    def __init__(self, the_protocol, port, reactor):
# type, host and port are used for my own purposes.
        self.type = "Local"
        self.host = None
        self.port = port
        SerialPort.__init__ (self, the_protocol, port, reactor)

    def loseConnection(self):
      
        # Fix
        self.protocol.transport.flushInput()
        self.protocol.transport.flushOutput()
       
        # call upper class method
        SerialPort.loseConnection (self)


at least under windows, when i call: serial_port.loseConnection()

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\twisted\python\log.py", line 84, 
in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "C:\Python24\Lib\site-packages\twisted\python\log.py", line 69, 
in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "C:\Python24\Lib\site-packages\twisted\python\context.py", line 
59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "C:\Python24\Lib\site-packages\twisted\python\context.py", line 
37, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File 
"C:\Python24\Lib\site-packages\twisted\internet\win32eventreactor.py", 
line 194, in _runWrite
    closed = fd.doWrite()
  File "C:\Python24\Lib\site-packages\twisted\internet\abstract.py", 
line 101, in doWrite
    self.dataBuffer = buffer(self.dataBuffer, self.offset) + 
"".join(self._tempDataBuffer)
exceptions.AttributeError: 'MySerialPort' object has no attribute 
'_tempDataBuffer'

Slds.

-- 
Nestor A. Diaz
Ingeniero de Sistemas
Tel. +57 1-600-5490 x 211
Cel. +57 316-227-3593
Tel. SIP: sip:211 at tiendalinux.com
Email/MSN: nestor at tiendalinux.com
http://www.tiendalinux.com/
Bogota, Colombia 





More information about the Twisted-Python mailing list