hp1975
Posts: 26
Joined: Sat Aug 22, 2015 5:09 pm

RPi Adafruit 16x2 LCD Internet Radio - Python Script error

Tue Sep 01, 2015 10:50 am

Hello All,

I've been tinkering with the Pi and scouring the net for hours trying to solve this and I'm stumped so I've come here hopefully for some assistance (

I'm trying to build an internet radio following this guide http://www.instructables.com/id/Raspber ... /?ALLSTEPS

It was all going ok until i tried to actually get the Radio scripts to work with the LCD.

I know that I2C is working because the example .py script that cycles colours on the screen and lets you test the buttons works fine.
I know that MPD and MPC work because I can get a stream to play if I run it direct from the command line.

BUT when I run what I assume is the main radio script 'radio.py' I get this error:

Code: Select all

pi@raspberrypi ~/radio $ sudo python radio.py
['mpc', 'stop']
mpc stop --> ['volume:100%   repeat: off   random: off   single: off   consume: off']
Traceback (most recent call last):
  File "radio.py", line 385, in <module>
    Radio().run()
  File "radio.py", line 267, in __init__
    Adafruit_CharLCDPlate(),
  File "/home/pi/radio/Adafruit_CharLCDPlate.py", line 81, in __init__
    self.i2c = Adafruit_I2C(addr, busnum, debug)
  File "/home/pi/radio/Adafruit_I2C.py", line 36, in __init__
    busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
Googling around, popular opinion seems to be that this is a problem with the I2C not being enabled, but as the example script works fine I can only assume its something else. I have no experience of Python and so I'm struggling with deciphering this error.

I'd really appreciate some help with this, as I bet there are loads of folks that have had a crack at this project!

Cheers

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPi Adafruit 16x2 LCD Internet Radio - Python Script err

Tue Sep 01, 2015 11:52 pm

sudo raspi-config
That program (it's a shell script) has an option to enable I2C.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

hp1975
Posts: 26
Joined: Sat Aug 22, 2015 5:09 pm

Re: RPi Adafruit 16x2 LCD Internet Radio Python Script [sol

Wed Sep 02, 2015 11:26 am

Thanks Dougie but I solved this. The I2C was always enabled because the adafruit lcd test script worked. I discovered that the copy of the Adafruit_I2C.py file I was using was three years old. I grabbed the latest from the Adafruit github repo and everything works like a charm.

Return to “Python”