Page 1 of 1

Import RPi.GPIO

Posted: Mon Jan 27, 2014 2:41 am
by RCobbTX
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.

Re: Import RPi.GPIO

Posted: Mon Jan 27, 2014 3:47 am
by smithg400
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.

Re: Import RPi.GPIO

Posted: Mon Jan 27, 2014 8:59 am
by texy
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