When I write a program in Python using IDLE3, I can run it from the IDLE3 Python shell. But when I add GPIO.setup(7, GPIO.out) to my code I get an error message 'No access to DEV/MEM Try running as root.
To make it run, I have to go to the terminal and type SUDO python filename.py then it works.
The identical code on my friend's Raspberry Pi runs perfectly from within the IDLE3 Python shell. I have spent hours trying to get to the bottom of this problem and got nowhere, please can someone help me?
In order to access GPIO's you must run as root as Linux will not let you play around with the hardware without the right privileges. So you are right that you need sudo, but i suspect your friend is also running as root somehow (see previous post)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Thank you for such a prompt and correct answer, and I will try and be more precise with error messages etc. in the future.
Yes, my friend was indeed invoking IDLE3 by typing sudo IDLE3 at the terminal, whilst I was invoking it from the GUI desktop.
So this (my first!) post is now closed - thanks again
I'm new to RPI 2 and have simmelar question.
I've setup my RPI with VCN as described in my living room and was able to open, edit and run existing ,py scripts from my desktop using VCN.
Then I moved the RPI to the basement where the sensors are and created my first scrip. Everything's fine till I hit the first GPIO command and get the "No access to /dev/mem" error.
When trying the "sudo idle3" in the LXTerminal, I get the error blow.