It took a good bit to figure out what the error was, I’m not sure if the behavior with this error is intentional.
The error message was decently misleading while debugging my code. (because I didn’t have any =s in the text I was using)
Additional information
Taking a quick look at the source, it looks like that error message is commented as for not numbers but is also the default case... which doesn't necessarily have an = in it
Python 3.9.6 (default, Aug 11 2021, 01:29:00)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '{:09}'.format('Jan')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: '=' alignment not allowed in string format specifier
>>>
Since this is about the core, I've prepared a fix and offered it to micropython. We can make a decision whether to take it ourselves, independently of whether they accept the change: micropython#8156
TG-Techie commentedJan 10, 2022
CircuitPython version
Code/REPL
Behavior
The behavior circuitpython is:
Description
the behavior on python 3.10 is:
It took a good bit to figure out what the error was, I’m not sure if the behavior with this error is intentional.
The error message was decently misleading while debugging my code. (because I didn’t have any
=s in the text I was using)Additional information
Taking a quick look at the source, it looks like that error message is commented as for not numbers but is also the default case... which doesn't necessarily have an = in it
circuitpython/py/objstr.c
Lines 1378 to 1389 in 476b17b
I'm more than glad to PR a different error message! I’m not sure if this is a large enough edge case to merit a PR?
Or PR a check for an equal and display this message and display a more generic "we don’t know what to do with the given formatter" otherwise.
The text was updated successfully, but these errors were encountered: