I'm trying to read a binary file into a buffer and then transmit it using pyserial/xmodem.
my test code:
send_buf = open('test.py', 'rb')
xmInst = XMODEM(self.getc, self.putc)
xmInst.send (send_buf)
xmodem send code:
...
data = stream.read(packet_size)
if not data:
break/
total_packets += 1
data = data.ljust(packet_size, self.pad)
However, when it executes that last line it says 'must be a byte string of length 1, not str'. Presumably a byte / string / unicode issue?
The xmodem package was written for python 2.7, so how do I read/pass the file in Python 3.4 such that xmodem can work with it?