which version of xmodem are you using, should be 3.4.5
There was an issue with NAK processing (packed should be resent) that was corrected in version 0.4.1 (way back in 2015), see:
https://github.com/tehmaze/xmodem/pull/12
It's been a while since I have worked with half-duplex transfer protocol, at the packet level, but I question your code
'readUntil(NAK)', especially after the manual delay. Seems that the packet should be resentand that the delay should be handled by the hardware.
(keeping in mind I am very rusty on this).
the suggested method is:
is there any valid reason why you are using python 2.7?
If possible you should upgrade to 3.7.1.
2.7 is at the end of it's life cycle and soon will no longer be supported.
One final question, it looks to me like the error you post is not verbatim (but that could just be antique python, can't remember 2.7 error meggases). If not, please post entire unmodified error traceback.
There was an issue with NAK processing (packed should be resent) that was corrected in version 0.4.1 (way back in 2015), see:
https://github.com/tehmaze/xmodem/pull/12
It's been a while since I have worked with half-duplex transfer protocol, at the packet level, but I question your code
'readUntil(NAK)', especially after the manual delay. Seems that the packet should be resentand that the delay should be handled by the hardware.
(keeping in mind I am very rusty on this).
the suggested method is:
>>> import serial >>> from xmodem import XMODEM >>> ser = serial.Serial('/dev/ttyUSB0', timeout=0) # or whatever port you need >>> def getc(size, timeout=1): ... return ser.read(size) or None ... >>> def putc(data, timeout=1): ... return ser.write(data) # note that this ignores the timeout ... >>> modem = XMODEM(getc, putc)see: https://pypi.org/project/xmodem/
is there any valid reason why you are using python 2.7?
If possible you should upgrade to 3.7.1.
2.7 is at the end of it's life cycle and soon will no longer be supported.
One final question, it looks to me like the error you post is not verbatim (but that could just be antique python, can't remember 2.7 error meggases). If not, please post entire unmodified error traceback.