bjorne
Posts: 3
Joined: Fri Dec 26, 2014 4:01 pm

Installing the Python GPIO library

Fri Dec 26, 2014 4:28 pm

After having spent a considerable part of the Christmas trying to install the
GPIO library I finally just found the answer. As I have noticed there are numerous others with the same problem, "no module with this name", so I thought I'd write a little notice about it. There seems to be as many ideas how to deal with this problem as there are answerers. But no one except for the last one could see the real problem. Look at this line:
import RPI.GPIO as GPIO. It won't work. Do you know why?
Because the I in RPI shall not be capital but small case, RPi.
A dirty trick if you ask me. I wonder how many that are struggling with this right now. You must also be superuser to make it work, open idle like this: sudo idle,will do it.
Another thing that I found a little strange was this. Before different suggestions on how to this and that, there was often a text in big letters:
CODE:SELECT ALL. Was I supposed to write that or what is it?

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Installing the Python GPIO library

Fri Dec 26, 2014 5:53 pm

CODE:SELECT ALL. Was I supposed to write that or what is it?
Simple. It's a 'code block' as used here on the forum and it actually helps you copying all the code in the block :mrgreen:

Code: Select all

command
By clicking on the 'select all' you do just that: select all the code.
Now you can copy the block the normal way for your platform and paste it somewhere else.

BTW: if you have Raspbian installed you shouldn't have to install RPi.GPIO; AFAIK the current version is pre-installed.

Gr.
Dirk.

bjorne
Posts: 3
Joined: Fri Dec 26, 2014 4:01 pm

Re: Installing the Python GPIO library

Sat Dec 27, 2014 10:01 am

I have know that, but as I didn't notice that RPi should have a lower case i
in "import RPi.GPIO" nothing worked.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Installing the Python GPIO library

Sat Dec 27, 2014 1:55 pm

Post your code on here. Wrap it in [code]...[/code] tags so you don't lose any formatting.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
davidcoton
Posts: 5026
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Installing the Python GPIO library

Sat Dec 27, 2014 8:52 pm

@Dougie

I think the OP knows what's wrong. Posted here so the rest of us could avoid mistyping RPi.GPIO as RPI.GPIO.

The OP's only question was about CODE: SELECT ALL, which is answered above :)
Signature retired

Return to “General discussion”