[Twisted-Python] SerialPort.loseConnection() BUG

Hello, there is a bug on the SerialPort Win32 implementation (don't know about the others), when i call the loseConnection method, it returns: twisted matrix exceptions.AttributeError: 'SerialPort' object has no attribute '_tempDataBuffer' if i wrap the serialport class and put a : self._tempDataBuffer = '' in the __init__ method, i get: raise NotImplementedError("%s does not implement writeSomeData" % exceptions.NotImplementedError: __main__.MySerialPort does not implement writeSomeData however the port gets closed the right way. Slds. -- Nestor A. Diaz Ingeniero de Sistemas Tel. +57 1-600-5490 x 211 Cel. +57 316-227-3593 Tel. SIP: sip:211@tiendalinux.com Email/MSN: nestor@tiendalinux.com http://www.tiendalinux.com/ Bogota, Colombia

On Wed, 10 Jun 2009 11:20:15 +0800, biziap biziap <fetbiz@gmail.com> wrote: Please don't top-post.
Maybe you can try to call transport.flushInput(), transport.flushOutput() before loseConnection().
No, this is wrong. Do not call these methods, ever.
Can you provide a minimal example which demonstrates this behavior? It is perhaps a bug in Twisted, but it is difficult to know without being able to see *exactly* how the behavior is triggered. Thanks, Jean-Paul

On 10 Jun, 12:23 pm, exarkun@divmod.com wrote:
Please don't top-post.
Since I'm seeing more and more messages where someone is top-posting, I think it might be helpful if we sent a more specific example of a positive example of what replies are expected to look like. I think for now it might be good to say we prefer this style: http://en.wikipedia.org/wiki/Posting_style#Inline_replying anybody else have a better reference?

glyph@divmod.com wrote:
Since I'm seeing more and more messages where someone is top-posting, I think it might be helpful if we sent a more specific example of a
You could try not being anal about it. In 2 decades working in investment banks I don't think I've seen a work evironment where it isn't the norm. Some of us even prefer it.

On Thu, 11 Jun 2009 08:11:42 +0000, biziap biziap <fetbiz@gmail.com> wrote:
Do you have an example which demonstrates the problem? There's no way to know why you encounter the problem without knowing what your program is doing.
Sorry about the top-post, hope that this time I am doing it right.
Yes. Thanks. :) Jean-Paul

2009/6/11 Jean-Paul Calderone <exarkun@divmod.com>:
I am developing a program which verifies every PCB in manufacturing factory. The tester (WindowsXP user) has to plug on the serial port for the testing process, then unplug for next testing. The serial connection has to connect and disconnect for every testing, that's where the problem happened. Since the whole program requires some device-specific modules to run. I will cut it down to a neat version which can re-produce the problem. It takes time. Soon after it has done, I will post it. Iap

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@tiendalinux.com Email/MSN: nestor@tiendalinux.com http://www.tiendalinux.com/ Bogota, Colombia

On 6/16/09 12:37 PM, Nestor A. Diaz wrote:
Looks like you are running into this bug: http://twistedmatrix.com/trac/ticket/1248 I wish I could be more helpful, but at least you know it's a known issue and where to start addressing it.

On Wed, 10 Jun 2009 11:20:15 +0800, biziap biziap <fetbiz@gmail.com> wrote: Please don't top-post.
Maybe you can try to call transport.flushInput(), transport.flushOutput() before loseConnection().
No, this is wrong. Do not call these methods, ever.
Can you provide a minimal example which demonstrates this behavior? It is perhaps a bug in Twisted, but it is difficult to know without being able to see *exactly* how the behavior is triggered. Thanks, Jean-Paul

On 10 Jun, 12:23 pm, exarkun@divmod.com wrote:
Please don't top-post.
Since I'm seeing more and more messages where someone is top-posting, I think it might be helpful if we sent a more specific example of a positive example of what replies are expected to look like. I think for now it might be good to say we prefer this style: http://en.wikipedia.org/wiki/Posting_style#Inline_replying anybody else have a better reference?

glyph@divmod.com wrote:
Since I'm seeing more and more messages where someone is top-posting, I think it might be helpful if we sent a more specific example of a
You could try not being anal about it. In 2 decades working in investment banks I don't think I've seen a work evironment where it isn't the norm. Some of us even prefer it.

On Thu, 11 Jun 2009 08:11:42 +0000, biziap biziap <fetbiz@gmail.com> wrote:
Do you have an example which demonstrates the problem? There's no way to know why you encounter the problem without knowing what your program is doing.
Sorry about the top-post, hope that this time I am doing it right.
Yes. Thanks. :) Jean-Paul

2009/6/11 Jean-Paul Calderone <exarkun@divmod.com>:
I am developing a program which verifies every PCB in manufacturing factory. The tester (WindowsXP user) has to plug on the serial port for the testing process, then unplug for next testing. The serial connection has to connect and disconnect for every testing, that's where the problem happened. Since the whole program requires some device-specific modules to run. I will cut it down to a neat version which can re-produce the problem. It takes time. Soon after it has done, I will post it. Iap

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@tiendalinux.com Email/MSN: nestor@tiendalinux.com http://www.tiendalinux.com/ Bogota, Colombia

On 6/16/09 12:37 PM, Nestor A. Diaz wrote:
Looks like you are running into this bug: http://twistedmatrix.com/trac/ticket/1248 I wish I could be more helpful, but at least you know it's a known issue and where to start addressing it.
participants (6)
-
biziap biziap
-
glyph@divmod.com
-
James Mansion
-
Jean-Paul Calderone
-
Lucas Taylor
-
Nestor A. Diaz