Hi,
I have a cobbler and I2C seven segment LED backpack connected to my raspberry (running wheezy). Running the example code (ex_7segment_clock.py) that comes with the library works great (sudo python ex_7segment.py). But when I open the code in IDLE and try to run, I get a permission error deep down in Adafruit_I2C.py, and I'm not sure how to fix this. Any help would be appreciated.
Here's what I see in the IDLE shell:
Traceback (most recent call last):
File "/home/pi/backpack/ex_7segment_clock.py", line 5, in <module>
from Adafruit_7Segment import SevenSegment
File "/home/pi/backpack/Adafruit_7Segment.py", line 5, in <module>
from Adafruit_LEDBackpack import LEDBackpack
File "/home/pi/backpack/Adafruit_LEDBackpack.py", line 92, in <module>
led = LEDBackpack(0x70)
File "/home/pi/backpack/Adafruit_LEDBackpack.py", line 31, in __init__
self.i2c = Adafruit_I2C(address)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack/Adafruit_I2C.py", line 36, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 13] Permission denied
problem with I2C and LED backpack in Python
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
- balloon-pilot
- Posts: 6
- Joined: Thu Feb 16, 2012 9:17 am
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: problem with I2C and LED backpack in Python
You probably need to run IDLE as superuser.
- xyzones
- Posts: 3
- Joined: Fri Oct 10, 2014 7:11 pm
Re: problem with I2C and LED backpack in Python
you do not have permission with your user to /dev/i2c-1
you need to add your user to the right group and not more root needed.
you need to add your user to the right group and not more root needed.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: problem with I2C and LED backpack in Python
Yep make sure IDLE is run as a root user so it can access the hardware of the Pi. Alternatively you can do some config with udev to make the SPI devices belong to a group that isn't root, check out this page for more details. It's a little advanced to do that configuration though so you might just run IDLE as root.
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/