Why is
struct.pack("!bbbb", 0x2, r, g, b)
failing in my python code when r, g, or b is > 127?
I know that the "b" means the size of a given value is 1 byte according to the struct docs, but why does it fail with values over 127?
127? I know that the "b" means the size of a given value..." /> 127? I know that the "b" means the size of a given value..." /> 127? I know that the "b" means the size of a given value..."/>
Why is
struct.pack("!bbbb", 0x2, r, g, b)
failing in my python code when r, g, or b is > 127?
I know that the "b" means the size of a given value is 1 byte according to the struct docs, but why does it fail with values over 127?
According to the documentation,
b
stands for:which means its valid range is [-128, 127]. And that's what the error messages says explicitly:
Using
B
yields no error: