adafruit/Adafruit_CircuitPython_framebuf

RuntimeError: Invalid font File

Closed this issue · 9 comments

I got the following when trying to run the rfm9x_check.py code provided on the adafruit website. Any help would be great

Traceback (most recent call last):
File "radio.py", line 39, in
display.text('RFM9x: Detected', 0, 0, 1)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 415, in text
self._font = BitmapFont(font_name)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 494, in init
raise RuntimeError("Invalid font file: " + font_name)
RuntimeError: Invalid font file: font5x8.bin

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "radio.py", line 40, in
except RunTimeError as error:
NameError: name 'RunTimeError' is not defined

This wasn't a matter of being able to find it. I've downloaded that file and it did not solve the issue, it seems that this is critical to getting the rfm9x boards to run

@ManicalEngineer can you post a link to the guide page that you are working from?

At least one of the issues seems to be that somewhere you've got code with RunTimeError in it, note the capital T whereas python is expecting RuntimeError

What kind of environment are you attempting to run this on? I see python3.5 folder so I assume something like Raspberry Pi, is that right?

the font file needs to be in the same folder as the script you are running
plz see instructions here! https://learn.adafruit.com/lora-and-lorawan-radio-for-raspberry-pi/rfm9x-raspberry-pi-setup#installing-circuitpython-libraries-3013548-2

@FoamyGuy thanks for pointing that out - fixed that and re-ran that the script, got the following:
Traceback (most recent call last):
File "radio.py", line 39, in
display.text('RFM9x: Detected', 0, 0, 1)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 415, in text
self._font = BitmapFont(font_name)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 494, in init
raise RuntimeError("Invalid font file: " + font_name)
RuntimeError: Invalid font file: font5x8.bin

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "radio.py", line 41, in
display.text('RFM9x: ERROR', 0, 0, 1)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 415, in text
self._font = BitmapFont(font_name)
File "/usr/local/lib/python3.5/dist-packages/adafruit_framebuf.py", line 494, in init
raise RuntimeError("Invalid font file: " + font_name)
RuntimeError: Invalid font file: font5x8.bin

@ladyada it is in the same folder (see output from ls -l below)

pi@raspberrypi:~ $ ls -l
total 124
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Desktop
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Documents
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Downloads
-rw-r--r-- 1 root root 80494 Oct 22 01:11 font5x8.bin
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Music
drwxr-xr-x 4 pi pi 4096 Oct 22 01:01 oldconffiles
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Pictures
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Public
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 python_games
-rw-r--r-- 1 root root 1401 Oct 22 22:16 radio.py
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Templates
drwxr-xr-x 2 pi pi 4096 Mar 13 2018 Videos

the font file size is not correct, check you are downloading it properly

image

how do I download it correctly? I've been using wget

I did wget https://github.com/adafruit/Adafruit_CircuitPython_framebuf/raw/master/examples/font5x8.bin and it worked this time. However I did try wget from the other address provided and it did not.

Thank you for helping resolve this