kenschneider18 / rpi-metro-display

Code for Raspberry Pi based dot matrix DC Metro times display
GNU General Public License v2.0
71 stars 9 forks source link

Can't Execute #12

Closed kattivo1 closed 3 years ago

kattivo1 commented 3 years ago

Greetings, thank you for the work you've done coding / documenting this project! I would classify myself as a beginner-intermediate type, I have just enough knowledge to move around but there are still gaping holes in my knowledge that might cause me to miss something obvious.

I have a Raspberry Pi 4 model B running DietPi (64 bit). I am using the Adafruit hat with 2 x 64 x 32 LED panels.

Nothing happens when I run the metro-display service.

My run.sh: python /home/dietpi/metro-sign/rpi-metro-display/rpi-metro-display.py /home/dietpi/metro-sign/rpi-metro-display/log.txt <WMATA API key> C12 1 /home/dietpi/metro-sign/rpi-metro-display/6x10.bdf /home/dietpi/metro-sign/rpi-metro-display/lines.json /home/dietpi/metro-sign/rpi-metro-display/stations.json

Help!

kattivo1 commented 3 years ago

Replaced all the /home/dietpi with /root/ and it starts. I now have a log.txt, but the error:

File "graphics.pyx", line 32, in rgbmatrix.graphics.Font.LoadFont Exception: Couldn't load font /root/metro-sign/rpi-metro-display/6x10.bdf

The font is there (I copied it a second time to make sure it wasn't corrupt). Everything in the path looks correct also. Stuck...again.

kattivo1 commented 3 years ago

Might get there...if in run.sh I list the font as 6x10.bdf instead of /root/metro-sign/rpi-metro-display/6x10.bdf it works for a minute, then errors out for 'couldn't access stations.json'. If I remove the leading path for stations.json, it works. Will it stay working?

kenschneider18 commented 3 years ago

I think you installed everything while you were logged into the Pi as the user root rather than dietpi. Which is totally fine and everything should still work, but like you already seem to have done you have to replace all the /home/dietpi's with /root. Can you post the run.sh you have now? It might help to have that context.

One thing I would try as well. Try running the whole Python command in the shell from the project directory i.e. /root/metro-sign/rpi-metro-display and drop all the prefixes.

python rpi-metro-display.py log.txt <WMATA API key> C12 1 6x10.bdf lines.json stations.json

Seems like it's still having trouble finding the files. Whether that works or doesn't it will give us a little more information as to what's happening here.

kattivo1 commented 3 years ago

You're right, of course - I missed that one detail about running the install from the dietpi account. I have it running now using the run.sh:

root@DietPi:~/metro-sign/rpi-metro-display# cat run.sh #!/bin/bash python /root/metro-sign/rpi-metro-display/rpi-metro-display.py /root/metro-sign/rpi-metro-display/log.txt <API key> C12 1 6x10.bdf lines.json stations.json

It will run with sudo ./run.sh from the rpi-metro-display folder, but it won't run on boot. I may just reinstall from get-go to eliminate that variable.

kenschneider18 commented 3 years ago

Okay glad to hear you’ve got it running at least. The failure to run on boot makes sense. When you run it using systemctl you need to put the canonical paths of all the rather than the relative paths so I’m guessing if you could easily see the logs it would say that it can’t find the font or lines/stations files.

What’s the output of running pwd from the directory you’re running sudo run.sh?

kenschneider18 commented 3 years ago

Also, for the metro-display.service you’ll need to edit that to use /root/metro-display and re-copy that to systemd if you haven’t already.

kattivo1 commented 3 years ago

Alright - good news, it's working as you designed it and wrote up the install procedure. I re-imaged DietPi and reinstalled from zero. The problems I had were:

Works great now, everything as it should! Sorry for being a n00b.

kenschneider18 commented 3 years ago

Glad to hear it’s all working now! That’s good feedback, I can use that to try and make the install guide better for other folks because trust me you won’t be the last person to hit these issues.

Don’t worry lol, I was a n00b myself not too long ago :)

kenschneider18 commented 3 years ago

Closing due to inactivity.