rbarrois / mpdlcd

A small tool to display MPD status on a lcdproc server
MIT License
31 stars 10 forks source link

python errors on Debian Jessie (Volumio) #23

Open thefoster opened 3 years ago

thefoster commented 3 years ago

After installing mpdlcd (sudo pip install mpdlcd) and the various python dependancies i couldn't get it to run. LCDd basically works (listener on localhost:13666), but mpdlcd (0.5.2) fails to start:

_sudo /etc/init.d/mpdlcd start (/usr/local/bin/mpdlcd --no-syslog &)
[19:44][nf@vox:~ ]$ Traceback (most recent call last):
File "/usr/local/bin/mpdlcd", line 7, in <module>
from mpdlcd import cli
File "/usr/local/lib/python2.7/dist-packages/mpdlcd/cli.py", line 5, in <module>
import configparser
ImportError: No module named configparser_

sudo pip install configparser doesn't seem to install that module properly (says installed, but doesn't appear in pip list) Even tried to switch to python3 (sudo ln -sf /usr/bin/python3 /usr/bin/python), which leads to other errors:

_[18:36][nf@vox:~ ]$ sudo /etc/init.d/mpdlcd start               
[18:36][nf@vox:~ ]$ INFO mpdlcd.lcdrunner LCD screen is 16x2
INFO mpdlcd.lcdrunner MPD screen added to lcdproc.
Traceback (most recent call last):
File "/usr/local/bin/mpdlcd", line 10, in <module>
cli.main(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/mpdlcd/cli.py", line 523, in main
'retry_attempts', 'retry_backoff', 'retry_wait'))
File "/usr/local/lib/python3.4/dist-packages/mpdlcd/cli.py", line 259, in run_forever
runner.setup_pattern(pattern_list, hook_registry=mpd_hook_registry)
File "/usr/local/lib/python3.4/dist-packages/mpdlcd/lcdrunner.py", line 82, in setup_pattern
self.pattern = patterns[self.screen.height]
File "/usr/local/lib/python3.4/dist-packages/mpdlcd/display_pattern.py", line 488, in __getitem__
prefix = [''] * (key - shorter / 2)
TypeError: can't multiply sequence by non-int of type 'float'_

I didn't think enabling the LCD would be such an effort/mess. Do you have any ideas from developers sight?

BR

rbarrois commented 3 years ago

I'm afraid you've broken your Debian installation :/ You should never use sudo pip install: system packages are managed by your distribution's package manager (apt), whereas language package managers don't know how that part is supposed to work.

Have you tried running it in a virtualenv?

mkdir -p ~/mpdlcd
python3 -m venv ~/mpdlcd/venv
. ~/mpdlcd/venv/bin/activate
pip install mpdlcd
thefoster commented 3 years ago

Thanks for your reply. It is actually a Volumio, but i'm aware that pip with priviledged rights isn't harmless. But as those modules don't exist (al least not in the proper version), i gave that a try, AFAIK they didn't overwrite system python modules. I'm pretty sure i managed that before (with a different LCD), but can't remember the trick for mpdlcd, how to avoid that error message.