ESPHomeMatrixLED
ESPHomeMatrixLED copied to clipboard
Error loading ttf font for m5atom Example
Hallo,
I try to run the ESPhome Example on my M5atom-matrix. I User the latest ESPHome 1.16. I het the following error running the Example:
ERROR Could not load truetype file DejaVuSans.ttf: expected string or bytes-like object
And idea what Goes wrong?
Gr. Remco
Do you have that TTF file in the same directory as the YAML file? If yes, I would look at it with a font viewer to see if it got corrupted somehow, or just download it again.
Hello, The font file is in the same directory as the yaml file and I can open de ttf file on MacOS without and Problem. The font looks fine ?? Looks like a ESPHOME 1.16 or Python Pillow Problem when i search the Internet. I Use python 3.8.7 inside a Home Assistant Docker
total 18880
drwxr-xr-x 3 root root 4096 Mar 1 12:34 .
drwxrwxrwx 12 root root 4096 Mar 2 08:09 ..
drwxr-xr-x 8 root root 4096 Mar 1 12:09 .git
-rw-r--r-- 1 root root 705684 Mar 1 12:09 DejaVuSans-Bold.ttf
-rw-r--r-- 1 root root 757076 Mar 1 12:34 DejaVuSans.ttf
-rw-r--r-- 1 root root 1203 Mar 1 12:09 LICENSE
-rw-r--r-- 1 root root 1245 Mar 1 12:09 README.md
-rw-r--r-- 1 root root 4619664 Mar 1 12:09 clock.gif
-rw-r--r-- 1 root root 3639 Mar 1 12:48 m5atom_marquee.yaml
-rw-r--r-- 1 root root 6713545 Mar 1 12:09 marqueeclock.gif
-rw-r--r-- 1 root root 7124 Mar 1 12:09 matrixleddemo.yaml
-rw-r--r-- 1 root root 8472 Mar 1 12:09 my_matrixled_scrolling_display.h
-rw-r--r-- 1 root root 53 Mar 1 12:10 secrets.yaml
-rw-r--r-- 1 root root 6479160 Mar 1 12:09 text.gif
bash-5.0#
bash-5.0#
bash-5.0# esphome m5atom_marquee.yaml compile
INFO Reading configuration m5atom_marquee.yaml...
INFO Generating C++ source...
ERROR Could not load truetype file DejaVuSans.ttf: expected string or bytes-like object
Running with verbose shows:
DEBUG Adding: // font:
DEBUG Adding: // id: tinyfont
// file: DejaVuSans.ttf
// size: 7
// glyphs:
// - ' '
// - '!'
// - '"'
// - '%'
// - (
// - )
// - +
// - ','
// - '-'
// - .
// - '0'
// - '1'
// - '2'
// - '3'
// - '4'
// - '5'
// - '6'
// - '7'
// - '8'
// - '9'
// - ':'
// - A
// - B
// - C
// - D
// - E
// - F
// - G
// - H
// - I
// - J
// - K
// - L
// - M
// - N
// - O
// - P
// - Q
// - R
// - S
// - T
// - U
// - V
// - W
// - X
// - Y
// - Z
// - _
// - a
// - b
// - c
// - d
// - e
// - f
// - g
// - h
// - i
// - j
// - k
// - l
// - m
// - n
// - o
// - p
// - q
// - r
// - s
// - t
// - u
// - v
// - w
// - x
// - y
// - z
// - °
// raw_data_id: uint8_t_2
ERROR Could not load truetype file DejaVuSans.ttf: expected string or bytes-like object
Gr. Remco
I just recompiled the demo YAML with esphome 1.16.3 without complaint. My only change was pointing to a font file in a different location. (I have a "fonts" directory for reuse with various projects.) However, I run esphome standalone, not in the HA docker image. I also build on Linux instead of a Mac, but that shouldn't make any difference.
Sorry, I don't have any other ideas.