2

I am trying to use twisted.internet.serial on Windows and it always fails to create with the message :

"File "C:\Program Files\Python36\lib\site-packages\twisted\internet_win32seria lport.py", line 65, in _finishPortSetup flags, comstat = win32file.ClearCommError(self._serial.hComPort) AttributeError: 'Serial' object has no attribute 'hComPort'"

I have tried on Windows 10 x64 as well as Windows 7 x64, running as administrator, with Python 3.6.1 and Python 2.7.13.

I have installed twisted 17.1.0, PySerial 3.3, pywin32 221.

It appears to me that PySerial has been revised at some point to privatize the com port handle as self._port_handle rather than self.hComPort which twisted is expecting.

Is this a known issue? Is there a work-around? Are twisted and/or PySerial being improved w/r/t this issue?

Thanks, Dick

R. Wilder
  • 41
  • 3

2 Answers2

2

To answer my own question, I have discovered that this issue has been known for over a year. See https://twistedmatrix.com/trac/ticket/8159 .

There is a work-around: it is patch #2 which can be found at the link above.

No word yet as to whether the twisted folks has put any priority on releasing this patch into the mainline.

R. Wilder
  • 41
  • 3
1

While Twisted is not updated to use newer PySerial versions, I have resolved this by downgrading PySerial to 'pyserial<3.0' (which installs pyserial==2.7).

pip install pyserial<3.0
jjmontes
  • 24,679
  • 4
  • 39
  • 51