Well, I continue to fumble along in this tiny little project... the pi and DAC+ are nicely mounted in the clock radio, and the LED is wired up and I can get it to turn on and off manually using a python script. But now I'm stuck at the stage of tying the LED state to the MPD state. Instead of posting a fresh thread, I'm hoping that adding some additional information to this Beginner's Question will help generate some suggestions...
I have installed python-mpd2 which I think is supposed to allow python to read the state of the MPD player --- I installed it into the root directory... because that's where I happened to be when I ran the installation.
Also, along the way I installed python 3. I see that my lib folder now includes python2.7, python3.5, and python3.6.
So... just to see if I could make something happen, I used some code from Frank on another thread using python-MPD, and stuck a print command at the end of what I guess is the "header" stuff:
- Code: Select all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#IMPORTS
import sys
import time
from mpd import (MPDClient,CommandError)
from socket import error as SocketError
HOST = 'localhost'
PORT = '6600'
PASSWORD = false
##
CON_ID = {'host':HOST, 'port':PORT}
##
print(client.status())
When I run this using python OR python2 I get an error on line 8: "Import Error: No module named mpd"
I have a hunch that the problem originates in either the multiple versions of python that are installed, OR in the fact that various components are saved in different locations. But of course, it may originate in something I don't know about - since I am a total noob...
Any advice for this greenhorn is much appreciated -- when I get past this basic issue, I look forward to messing around with the actual commands!