peterhinch / micropython-font-to-py

A Python 3 utility to convert fonts to Python source capable of being frozen as bytecode
MIT License
368 stars 67 forks source link

'Font filename must be a valid Python variable name' -- why? #18

Closed ironss closed 4 years ago

ironss commented 4 years ago

Using Linux, I try to generate a font.py file by pointing directly to a .TTF file

It fails with the error message 'Font filenames must be valid Python variable names.'

It does, however, allow me to generate an output file with a filename that is not a valid Python symbol.

I think the logic is reversed here. The OUTPUT filename should be a valid Python symbol, so it can be imported. The input font filename is irrelevant.

peterhinch commented 4 years ago

Well spotted, thank you. I will push an update shortly.

The test merely checks the first character to guard against names starting with characters such as digits.

peterhinch commented 4 years ago

Update now pushed.