2019-08-05 07:09:14 -04:00
|
|
|
"""
|
|
|
|
categories: Modules,struct
|
|
|
|
description: Struct pack with whitespace in format, whitespace ignored by CPython, error on uPy
|
|
|
|
cause: MicroPython is optimised for code size.
|
|
|
|
workaround: Don't use spaces in format strings.
|
|
|
|
"""
|
|
|
|
import struct
|
|
|
|
|
|
|
|
try:
|
2021-07-06 19:18:57 -04:00
|
|
|
print(struct.pack("b b", 1, 2))
|
|
|
|
print("Should have worked")
|
2019-08-05 07:09:14 -04:00
|
|
|
except:
|
2021-07-06 19:18:57 -04:00
|
|
|
print("struct.error")
|