1

After following the steps specified in Boeeerb's PiGlow github repo, when I try to run the test.py file it gives me the following message:

Traceback (most recent call last) :
   File "test.py" , line 9, in <module>
      piglow = PiGlow()
   File "/home/pi/piglow/piglow.py" , line 30,in _init_
      self.bus = SMBus(i2c_bus)
IOError: [Errno 2] No such file or directory

I have tried rebooting, and trying it multiple times. I also used the ls command to ensure the file is there. What's wrong there?

1
  • Can you provide line 30 of piglow.py? On the github repository it's self.bus = SMBus(i2c_bus). Commented Dec 28, 2013 at 14:20

1 Answer 1

1

Are you using Raspbian? If so, i2c is disabled by default. Let's get it enabled...

Make sure you've got updated packages and have i2c-tools installed. You likely do but just in case...

sudo apt-get update; sudo apt-get install python-smbus i2c-tools

All good? Add the i2c modules...

echo -e "i2c-bcm2708\ni2c-dev" | sudo tee --append /etc/modules

Cool? Now, make sure you remove them from the modprobe blacklist (if you have one)...

MPBL=/etc/modprobe.d/raspi-blacklist.conf; [ -f ${MPBL} ] && sudo perl -p -i -e 's:(blacklist (spi|i2c)-bcm2708):#$1:g' ${MPBL}

Sweet. Finally reboot the Pi...

reboot

Gold. Try it again. Working ok now? Got my info from here:

http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c

Thank you Lady Ada!! ;-)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.