Xmodem module 0.4.6

I’m using the xmodem module (xmodem · PyPI) and it works just fine. However, I’d like to incorporate some sort of progress indicator during the upload.

I kinda know my way around python but I’m no expert. Can someone point me in the right direction?

Can you post the code you use for the upload where you want a progress
indicator?

Not your entire script, just enough of it so we can see the upload.

The answer will be very different if it looks like:

xmodem.upload(data)

versus:

uploader = xmodem.Uploader(spam, eggs, cheese, aardvark, progressbar=False)
for chunk in split(data):
    uploader.upload(chunk)

etc. Also, be prepared to be told to read the xmodem docs, so if you
haven’t done that yet, you should do so :slight_smile:

I’m pretty much using the code from the docs (I’ve read the docs but they’re quite sparse)

#defines for xmodem module
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)

#start actual xmodemCRC transfer
stream = open(’/var/www/WebRCP/uploads/rc2107_66.bin’,‘rb’)
modem.send(stream)