Install & Compatibility
Where this runs
tested against v1.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.2s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
cobs
✓ import cobs.cobs as cobs
✗ import cobs
cobs package has submodules; 'import cobs' only imports the package, not the cobs.encode/decode functions.
cobsr
✓ import cobs.cobsr as cobsr
✗ from cobs import cobsr
cobsr is a submodule; use 'cobs.cobsr' for clarity.
Encode and decode data using COBS. The delimiter byte (0x00) is removed from the encoded output.
import cobs.cobs as cobs
data = b'\x00\x01\x02\x00\x03'
encoded = cobs.encode(data)
print('Encoded:', list(encoded))
decoded = cobs.decode(encoded)
print('Decoded:', list(decoded))
Errors
Common errors & fixes
AttributeError: module 'cobs' has no attribute 'encode'
Imported cobs package instead of cobs.cobs submodule.
fixChange to 'import cobs.cobs as cobs' or 'from cobs import cobs'
ValueError: decoded data contains unexpected zero byte
Encoded data includes a delimiter byte (0x00) that is not the final byte, or the decoder was given raw data.
fixEnsure you pass properly COBS-encoded data. Use cobs.encode() to encode before transmission.
cobs.decode() returns empty bytes when input contains only a trailing zero
A single 0x00 byte decodes to an empty byte string (valid COBS). This might be unexpected.
fixCheck for empty decoded output if protocol expects non-empty data.
Upgrade
Version history
1.2.2latest on PyPI · released Jul 20, 2025
Audit
Dependencies
No dependency data recorded yet.