Closed gorjious closed 3 years ago
Can you post a complete script that reproduces this? It may be specific to the font. If so: can you share the font?
I'm thinking it was an issue with absolute vs relative paths. I notice that leaving out the first slash causes this error so that may have been it.
However, I am trying to make a simple example to reproduce it, and am running into an issue that in 3.127 "font can't be found" and it doesn't render but in 3.126 it says "font is not installed" yet it still renders.
What should be the correct way of linking both absolute and relative paths?
Ah, I think I see what's going on: you should not use the output of font(...)
as another input for font(...)
. Just use the full path throughout (using a variable will make it more managable).
Relative file names are relative to the script's parent folder. So if you use "document_fonts/myfont.otf" there should be a folder called "document_fonts" in the same folder as where the script is saved.
The regression you're seeing is that previously, the font was temporarily installed, and could then be accessed by name (the output of font(...)
). That is no longer happening, and you should use the filename/path as the font's identifier.
Ah okay, that makes sense. Everything works now. Thank you, Just.
font(fontNameOrPath)
returns None
if fontNameOrPath
is neither the name of an installed font, nor an existing font file. Passing None
to font(None)
gives the same error as your example. I think the None
returning case should warn, and passing None
to font()
should give a better error message.
Upgraded to 3.127 from 3.126 and now getting this error in a file that was previously working:
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
Is this a bug or any suggestions on how to fix this?
The full error message is this: