Exception: Couldn't load font
Closed this issue · 8 comments
I keep getting the follow error:
INFO:infopanel.driver:Starting InfoPanel. Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/root/infopanel/infopanel/__main__.py", line 5, in <module> File "/root/infopanel/infopanel/driver.py", line 252, in run File "/root/infopanel/infopanel/driver.py", line 222, in driver_factory File "/root/infopanel/infopanel/sprites.py", line 791, in sprite_factory File "/root/infopanel/infopanel/sprites.py", line 435, in apply_config File "/root/infopanel/infopanel/sprites.py", line 353, in apply_config File "/root/infopanel/infopanel/sprites.py", line 153, in apply_config File "/root/infopanel/infopanel/helpers.py", line 41, in load_font File "graphics.pyx", line 32, in rgbmatrix.graphics.Font.LoadFont Exception: Couldn't load font ~/infopanel/5x8.bdf
As you can see, I moved the font to the infopanel as well to see if that would help, it doesn't. It definitely exists in that folder. The fonts work from the RPI-RGB-LED-MATRIX samples. Any ideas?
It's possible that the ~
isn't being expanded properly in your environment maybe? Can you try setting the full path to the font (e.g. by replacing ~
with /root/infopanel
or whatever the home path is her?
Yeah, I have tried using /root/infopanel as well with the same results. I also have given the font file 0755 permissions and that did not help either.
Also, I am using the following command to run the app python3 -m infopanel --config infopanel.yaml
Did a little more digging and got this working by adding the follow to rgbmatrix_options_factory
options.drop_privileges = 0
options.daemon = 0
any thoughts on why? Maybe allow the option to turn off drop_privileges from the config file?
oh interesting, and good find! I see that options is defined as::
Don't drop privileges from 'root' after initializing the hardware.
So I guess it starts out running as root to init the hardware but then drops down to some non-root user. Presumably this non-root user that the infopanel is running as just doesn't have permission to the location where the fonts are?
What user is your infopanel service running under? Is it not root?
You could probably also put the fonts in some other location, like /usr/local/fonts
or something.
I am logged into my pi as the root user, and I am also running the command with sudo, so I presume the app is running as root?
True, maybe I will just move my fonts to that directory and see if that works.
I am having an issue with the AnimatedGif type as well, would you like me to open a separate issue? The error is:
voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data['scenes']['cat']['type']
I am pointing to a gif file, but it seems it is not finding the AnimatedGif type?
Figured out the issue here as well. Incase anyone else runs into this:
The documentation on the main page with an example of the config is a little misleading, you need to set your gif in the sprites section, then declare it as a scene. If you set the path and type within the scene section, it will not work and throw the above error.
Glad you got both of those working.