RCobbTX
Posts: 10
Joined: Thu Jan 09, 2014 1:08 pm

Import RPi.GPIO

Mon Jan 27, 2014 2:41 am

import RPI.GPIO as GPIO
results in:

Traceback (most recent call last):
File "/home/pi/PinStatus.py", line 1, in <module>
import RPI.GPIO as GPIO
ImportError: No module named RPI.GPIO

I loaded latest version (0.5.4) and it placed itself in a /usr sub-directory 'as near as i can tell'
I assume this is a compiled 'C' mod to Python. Does the import command need a path.

smithg400
Posts: 148
Joined: Sat Dec 24, 2011 3:37 pm

Re: Import RPi.GPIO

Mon Jan 27, 2014 3:47 am

The title to your post says 'import RPi.GPIO' but your code says 'import RPI.GPIO as GPIO'. Python is case sensitive so it has to be a lower case i in RPi.

If your code does actually have 'use RPi.GPIO as GPIO' (and it is just a typo in your post), then are you sure you have the right package for the version of python you are using? You need the package python-rpi.gpio for python and python3-rpi.gpio for python3.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Import RPi.GPIO

Mon Jan 27, 2014 8:59 am

Hi,
as the previous poster has stated, python is case senesitive, so you need to make sure you are entering RPi.GPIO correctly (RPI.GPIO will not work).
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Beginners”