Python Forum
File transfer with xmodem CRC (1024) checksum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File transfer with xmodem CRC (1024) checksum
#2
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:
>>> 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.
Reply


Messages In This Thread
RE: File transfer with xmodem CRC (1024) checksum - by Larz60+ - Nov-07-2018, 09:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  File Transfer deezy 5 15,331 Feb-25-2019, 02:41 PM
Last Post: Jaylord
  file transfer with sockets sinister88 1 7,163 Nov-11-2017, 03:29 PM
Last Post: heiner55
  Pickle a file over a socket in 1024 segments HybridAK 7 15,493 Aug-08-2017, 06:54 AM
Last Post: HybridAK

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020