I have installed RPi.GPIO and can import it into a python script fine without a error but as soon as i try to manipulate any of the gpio's i always get a error saying

file "practice.py" line 5 in <module> 
AttributeError: 'module' object has no attibute 'setmode'

my code is

import RPi.GPIO as GPIO


my version of RPi.GPIO is .o.5.4 the latest one i believe.

i have looked everywhere on the internet for a solution on what I'm doing wrong please help me :(

2 Answers 2


It was a issue with how I downloaded RPi.GPIO.

I tried to download it myself through the internet, following a tutorial on youtube.

What I did was just find a tutorial on installing it from the command line.

Instead, there is another video on youtube that talks you through all the different ways of using the gpio ports and RPi.GPIO is one of them.

Any future people with this problem I would suggest installing it from the terminal/shell.


Is this the only script you've tried? I turn off my fish light with the following code called from CRON:

import RPi.GPIO as GPIO
import time

print "Turning off fish light"

I'm sure you have the right permissions for this - you can't do GPIO stuff unless you're root or root-like (Is that a word?) e.g sudo python fishoff.py. What's the rest of your code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.