partofthething / infopanel

Show live data, animations, pictures, or anything on simple displays like RGB matrices
https://partofthething.com/infopanel/
GNU General Public License v3.0
31 stars 12 forks source link

test_config.yaml fails to run #13

Closed avandeputte closed 5 years ago

avandeputte commented 5 years ago

I am unable to run infopanel, even using the test_config.yaml file provided. Below is the error:

root@raspberrypi:~/infopanel/infopanel/tests# python -m infopanel --config ./test_config.yaml INFO:infopanel.driver:Starting InfoPanel. Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/main.py", line 4, in driver.run() File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/driver.py", line 218, in run infopanel = driver_factory(disp, datasrc, conf) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/driver.py", line 192, in driver_factory driver.sprites = sprites.sprite_factory(conf['sprites'], data_src, disp) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/sprites.py", line 687, in sprite_factory sprite.apply_config(sprite_conf) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/sprites.py", line 372, in apply_config conf = FancyText.apply_config(self, conf) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/sprites.py", line 295, in apply_config conf = Sprite.apply_config(self, conf) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/sprites.py", line 90, in apply_config conf = self.CONF(conf) File "/usr/local/lib/python3.5/dist-packages/voluptuous-0.11.5-py3.5.egg/voluptuous/schema_builder.py", line 267, in call File "/usr/local/lib/python3.5/dist-packages/voluptuous-0.11.5-py3.5.egg/voluptuous/schema_builder.py", line 589, in validate_dict File "/usr/local/lib/python3.5/dist-packages/voluptuous-0.11.5-py3.5.egg/voluptuous/schema_builder.py", line 427, in validate_mapping voluptuous.error.MultipleInvalid: expected a list for dictionary value @ data['frames']

partofthething commented 5 years ago

That's the same as #4. I should update the code to work with modern versions of voluptuous as a better fix.

avandeputte commented 5 years ago

Thanks, downgraded the library per #4 and I got past that issue now. I am bit confused how the install succeeded considering you have it set to ====0.9.3 in requirements.txt.

Now it's failing with another error:

File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/sprites.py", line 98, in apply_config self.font = helpers.load_font(conf['font_name']) File "/usr/local/lib/python3.5/dist-packages/infopanel-0.1-py3.5.egg/infopanel/helpers.py", line 34, in load_font font.LoadFont(os.path.join(FONT_DIR, name)) # slow. File "graphics.pyx", line 32, in rgbmatrix.graphics.Font.LoadFont Exception: Couldn't load font /root/fonts/5x8.bdf

Which I really don't understand, because the font is there....

root@raspberrypi: /infopanel/infopanel/tests# head /root/fonts/5x8.bdf STARTFONT 2.1 COMMENT $Id: 5x8.bdf,v 1.32 2006-01-05 20:03:17+00 mgk25 Rel $ COMMENT Send bug reports to Markus Kuhn http://www.cl.cam.ac.uk/~mgk25/ FONT -Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO10646-1 SIZE 11 75 75 FONTBOUNDINGBOX 5 8 0 -1 STARTPROPERTIES 22 FONTNAME_REGISTRY "" FOUNDRY "Misc" FAMILY_NAME "Fixed" root@raspberrypi:~/infopanel/infopanel/tests#

partofthething commented 5 years ago

I have a better fix in the works for the voluptuous thing. I think it errored out in the install but somehow fell back on the newer version you have installed.

What user is the infopanel running as? If it's pi or something else other than root it may have trouble reading the fonts in /root/fonts.

What do you get if you just run ls /root/fonts from the same user that runs infopanel?

avandeputte commented 5 years ago

I am doing everything as root...

root@raspberrypi: # ls -al /root/fonts total 7256 drwxrwxrwx 2 root root 4096 Dec 16 21:33 . drwx------ 11 root root 4096 Dec 16 21:52 .. -rwxrwxrwx 1 root root 974681 Dec 16 21:33 10x20.bdf -rwxrwxrwx 1 root root 94333 Dec 16 21:33 4x6.bdf -rwxrwxrwx 1 root root 194747 Dec 16 21:33 5x7.bdf -rwxrwxrwx 1 root root 154919 Dec 16 21:33 5x8.bdf -rwxrwxrwx 1 root root 211073 Dec 16 21:33 6x10.bdf -rwxrwxrwx 1 root root 549703 Dec 16 21:33 6x12.bdf -rwxrwxrwx 1 root root 159441 Dec 16 21:33 6x13B.bdf -rwxrwxrwx 1 root root 512118 Dec 16 21:33 6x13.bdf -rwxrwxrwx 1 root root 95801 Dec 16 21:33 6x13O.bdf -rwxrwxrwx 1 root root 144785 Dec 16 21:33 6x9.bdf -rwxrwxrwx 1 root root 124748 Dec 16 21:33 7x13B.bdf -rwxrwxrwx 1 root root 400761 Dec 16 21:33 7x13.bdf -rwxrwxrwx 1 root root 103390 Dec 16 21:33 7x13O.bdf -rwxrwxrwx 1 root root 128518 Dec 16 21:33 7x14B.bdf -rwxrwxrwx 1 root root 327838 Dec 16 21:33 7x14.bdf -rwxrwxrwx 1 root root 141768 Dec 16 21:33 8x13B.bdf -rwxrwxrwx 1 root root 459959 Dec 16 21:33 8x13.bdf -rwxrwxrwx 1 root root 160613 Dec 16 21:33 8x13O.bdf -rwxrwxrwx 1 root root 270622 Dec 16 21:33 9x15B.bdf -rwxrwxrwx 1 root root 765675 Dec 16 21:33 9x15.bdf -rwxrwxrwx 1 root root 133756 Dec 16 21:33 9x18B.bdf -rwxrwxrwx 1 root root 835008 Dec 16 21:33 9x18.bdf -rwxrwxrwx 1 root root 2405 Dec 16 21:33 AUTHORS -rwxrwxrwx 1 root root 145955 Dec 16 21:33 clR6x12.bdf -rwxrwxrwx 1 root root 234648 Dec 16 21:33 helvR12.bdf -rwxrwxrwx 1 root root 15259 Dec 16 21:33 README -rwxrwxrwx 1 root root 652 Dec 16 21:33 README.md -rwxrwxrwx 1 root root 19964 Dec 16 21:33 tom-thumb.bdf root@raspberrypi:~#

avandeputte commented 5 years ago

The only thing I did do to the test_config.yaml is that I put the full path instead of the $ variable. Is that a problem somehow?

global: font_dir: /root/fonts

partofthething commented 5 years ago

No that's no problem, you can put the path directly in like that. It's very strange that you're getting that error.

avandeputte commented 5 years ago

I did have some mess ups / failed installs because of python vs python3. Might be time to start fresh with a new raspbian image.

partofthething commented 5 years ago

The voluptuous error is fixed in e858e0eab8635c8 at least.

For what its worth I just installed it in a fresh Raspbian image and updated the docs a bit to get over a few hurdles people have been reporting.

avandeputte commented 5 years ago

Are you installing the latest rpi-rgb-led-matrix from hzeller's github, or are you using the adafruit installer which actually downloads an older version from hzeller's github? Just wondering, because I am still struggling to get this to work.

avandeputte commented 5 years ago

Sorry to bother you, I am on my third complete fresh install of raspbian... Last couple times I can't get past this error:

root@raspberrypi: # python -m infopanel --config test.yaml Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/main.py", line 4, in driver.run() File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/driver.py", line 220, in run disp = display.display_factory(conf) File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/display.py", line 151, in display_factory options = rgbmatrix_options_factory(config['RGBMatrix']) File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/display.py", line 142, in rgbmatrix_options_factory options.led_pixel_mapper = config['led-pixel-mapper'] AttributeError: 'rgbmatrix.core.RGBMatrixOptions' object has no attribute 'led_pixel_mapper'

partofthething commented 5 years ago

I'm using the latest and greatest rpi-rgb-led-matrix library which will get you around that error. That attribute was apparently added in a recent version and due to a different request I added it as an option. Perhaps I can find a way to be backward compatible if it's easier to use the adafruit installer (I didn't know about that). If you just clone the base library and make/make install it and the python bindings that should get you around that.

avandeputte commented 5 years ago

Well, I get this error with the latest and greatest... FYI, I use the following shell scripts to handle all the steps as I understand them. And eventhough the matrix library is getting build for both python 2 and python 3, I am only using python 2 for your program. Is there anything below that seems wrong to you?

#!/bin/bash

apt-get update
apt-get upgrade

apt-get install -y --force-yes python-dev python-pillow python3-dev python3-pillow libyaml-dev python-setuptools python3-setuptools git python-matplotlib python3-matplotlib

# delete previous installs directories
rm -Rf rpi-rgb-led-matrix
rm -Rf infopanel
# download fresh copies
git clone https://github.com/hzeller/rpi-rgb-led-matrix.git
git clone https://github.com/partofthething/infopanel.git

cd rpi-rgb-led-matrix
# install for Python 2.7...
make clean
make build-python HARDWARE_DESC=adafruit-hat-pwm
make install-python HARDWARE_DESC=adafruit-hat-pwm

# Do over for Python 3...
make clean
make build-python HARDWARE_DESC=adafruit-hat-pwm PYTHON=$(which python3)
make install-python HARDWARE_DESC=adafruit-hat-pwm PYTHON=$(which python3)

# install infopanel
cd ../infopanel
python setup.py install
partofthething commented 5 years ago

I'm so sorry, looks like this is my fault. Your installation looks right to me. I just pushed 6e679080bf8 which should fix the issue. I had a request to add this option I didn't test it properly and now I've reverted it.

avandeputte commented 5 years ago

No worries, that's part of the fun of it :)

Now I am back to this error:

font.LoadFont(os.path.join(FONT_DIR, name)) # slow. File "graphics.pyx", line 32, in rgbmatrix.graphics.Font.LoadFont Exception: Couldn't load font /root/rpi-rgb-led-matrix/fonts/5x8.bdf

Now more investigating what is going on...

climy commented 5 years ago

I had very similar font trouble and it's working now. Try running as root. Remove sudo when you run infopanel as instructed again. Put test_config.yaml into /root/.infopanel/

Make sure you set the environment variable $export RPI_RGB_LED_MATRIX=/home/pi/

avandeputte commented 5 years ago

It is working now... I am not entirely sure why as I don't thing I changed anything really. I did do some edits on the yaml file here and there and saved it multiple times but I ended up with the same values as I started with. Perhaps some sort of character encoding issue in the yaml got fixed somehow. Who knows.

Anyway, thanks for your help. I am looking forward to really play with it and integrate it with my home assistant instance too!