XMODEM protocol implementation.
Project description
XMODEM protocol implementation
Documentation available at http://packages.python.org/xmodem/
Python Package Index (PyPI) page is available at https://pypi.python.org/pypi/xmodem
Usage
Create a function to get and put character data (to a serial line for example):
>>> 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)
Now, to upload a file, use the send method:
>>> stream = open('/etc/fstab', 'rb') >>> modem.send(stream)
To download a file, use the recv method:
>>> stream = open('output', 'wb') >>> modem.recv(stream)
For more information, take a look at the documentation.
Changes
- 0.4.7:
bugfix: stall on some kinds of error in recv(), PR #56.
bugfix: sequence number miscalculation in send(), PR #52.
enhancement: callback function added for recv(), PR #53.
bugfix: receiving empty file and stall condition in recv(), PR #50.
bugfix: callback is now called for some kinds of errors and some CLI fixes, 8a798e8b.
bugfix: remove DepreactionWarning for logging.warn(), PR #49.
- 0.4.6:
bugfix: Abort send on EOT in startup-sequence Issue #34.
enhancement: Include LICENSE file in the source distribution.
- 0.4.5:
bugfix: Remove bogus assert False code in recv() that resulted in AssertionError introduced in version 0.4.0 commit-id 9b03fc20, PR #29.
- 0.4.4:
bugfix: Large file transfers in send() were more likely to fail for small values of retry: This value should be the maximum failures per block transfer as documented, but was improperly implemented as the number of failures allowed for the total duration of the transfer, PR #21.
bugfix: send(retry=n) and recv(retry=n) should retry n times as documented, was retrying n - 1.
- 0.4.3:
bugfix: putc() callback was called in series, 3 times for each part of xmodem block header, data, and checksum during block transfer. Now all three data blocks are sent by single putc() call. This resolves issues when integrating with microcontrollers or equipment sensitive to timing issues at stream boundaries, PR #19.
- 0.4.2:
bugfix: documentation files missing from the release tarball Issue #16.
- 0.4.1
bugfix: re-transmit in send() on NAK or timeout, previously re-transmissions (wrongly) occurred only on garbage bytes. PR #12.
- 0.4.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file xmodem-0.4.7.tar.gz
.
File metadata
- Download URL: xmodem-0.4.7.tar.gz
- Upload date:
- Size: 34.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f1068aa8676f0d1d112498b5786c4f8ea4f89d8f25d07d3a0f293cd21db1c35 |
|
MD5 | 0a21c269cb4d3995d13a2615c24fed0a |
|
BLAKE2b-256 | 3d17fd6668a09afdc46c22990172b6f65e07dfb5bcf38960d063a7a887ca926d |
File details
Details for the file xmodem-0.4.7-py3-none-any.whl
.
File metadata
- Download URL: xmodem-0.4.7-py3-none-any.whl
- Upload date:
- Size: 35.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6a2c7608f7b187da786c47780f8407dbc4ac2d3dfeb34fe683cc19778f01360 |
|
MD5 | bee0eec41255a94c8d9364f9d2572d6a |
|
BLAKE2b-256 | 8c1ae383b538450963953d4e652d2bce0a4cfbcf15ecc8c34ab998bd1329c95d |
File details
Details for the file xmodem-0.4.7-py2.py3-none-any.whl
.
File metadata
- Download URL: xmodem-0.4.7-py2.py3-none-any.whl
- Upload date:
- Size: 35.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0842d2266175f01225053db721ea952b3f4b239cb3ace83c32b1daf90aa413af |
|
MD5 | caf320a0d526aaaba338016d1743c645 |
|
BLAKE2b-256 | 676b371c541d67e926d7e87e47aaa7117f8d30ac13dd16e64f9ac2ffdcdead44 |