I found the problem.
I forgot about:
GPIO.setup(<PIN>, <MODE>)
And without this Python throws and exception where write to try to run code with root.
Question
I have installed Raspbian on my Raspberry and added in:
/etc/rc.local:
chown /dev/ttyUSB0 #to allow current user to use 3G modem
/etc/sudoers:
raspbian ALL=NOPASSWD: ALL
And for autologin:
1:2345:respawn:/sbin/getty --autologin raspbian --noclear 38400 tty1
Before I can use GPIO from Python to write to GPIO pins.
Now when I try to run with sudo my Python script I receive an exception where is write that I can't access /dev/mem
I tried to add "raspbian" user to group "kmem" but don't works.
I tried to remove autologin and sudo without password, but also don't works.
I tried with WiringPi from C, and with WiringPi works.
Please help me to find a solution to use GPIO from python.
Solution
I found the problem.
I forgot about:
GPIO.setup(<PIN>, <MODE>)
And without this Python throws and exception where write to try to run code with root.