Search code examples
pythonraspberry-pigpioraspberry-pi2

Import Raspberry Pi GPIO error


I am using a Raspberry Pi 2 B and attempting the project on the following website: https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box/overview

However when I try to run the file "capture-positives.py", I get an error when trying to import the GPIO. I have tried updating the GPIO and removing and installing a fresh copy, however I keep getting the same error. I have a feeling it has to do with me using a Raspberry Pi 2 rather than a 1. Is there anyway to solve this error?

Update:

Left out the error section by mistake this is the error :

Traceback (most recent call last):  File "capture-positives.py", line 14, in <module>  import hardware  File "/home/pi/pi-facerec-box-master/hardware.py", line 8, in <module>  import RPIO  File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv7l.egg/RPIO/__init__.py", line 115, in <module>  import RPIO._GPIO as _GPIO  SystemError: This module can only be run on a Raspberry Pi!

Solution

  • The script (or more precisely, the hardware.py-module) uses the RPIO module which has seen it's last release 2013 (https://github.com/metachris/RPIO), and thus doesn't support the RPi2. You can either

    • create an issue in the RPIO-tracker, and hope for an updated version (not sure how likely that's going to happen though)
    • rewrite the hardware.py to use the GPIO module instead, but that might be a lot of work