I'm working on integrating my raspberry pi into a car display that shows some OBDII readouts. However when I auto start my python script none of the fonts get loaded and it looks like this:Startup script

However, it should really look like this:
enter image description here

When I manually open the script the fonts work perfectly, but they just don't work on the auto startup.

Does anyone know how to get the fonts working before my script starts?

  • I forgot to mention that when you manually open the script the fonts work perfectly, but they just don't work on the auto startup.
    – Z0ID8ERG
    Dec 1 '18 at 13:16
  • How do you auto start the script?
    – Ingo
    Dec 1 '18 at 13:24
  • I've tried a few different ways from crontab, adding a field to "/.config/lxsession/LXDE-pi/autostart", and I tried using init.d but I wasn't able to make it execute. This is my first time trying anything like this so I don't know the exact right way to do it.
    – Z0ID8ERG
    Dec 1 '18 at 13:27
  • Question is not what you tried, but how you actually started it when it shows the problem. Please show method and full command line (add these details to your question). BTW: do you set the font explicitly in the script?
    – Dirk
    Dec 1 '18 at 14:39

When you run your script "manually", you are running the script as the username under which you're logged in. When you "auto-start" the script with cron you are invoking the script as a different user.

Best guess: It seems to me that your problem may be that your "manual" user has access permission to the fonts, but your "cron" user does not. Alternatively, the "cron" user's $PATH may be different than the "manual" user's path, and therefore cron just doesn't know where to find the fonts.

If you'll revise your question to add your crontab entry, we'll try to be more specific.

  • Thank you very much for the reply! What you're saying makes a lot of sense now, but I did find a different way to fix my problem. I was using pygame to make the gui and it was calling to use an installed system font. Instead I switched it so it reads a local font file and now it works perfectly.
    – Z0ID8ERG
    Dec 2 '18 at 3:02
  • @Z0ID8ERG - Wonderful! Glad to hear you solved it.
    – Seamus
    Dec 2 '18 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.