Spending all day trying to get something working is absolutely perfectly normal, and dare I say encouraged! I spent many a night cluelessly hacking on code until 6AM until I got confident enough to convince people I was a programmer.
Once you’ve done your fresh install of Raspbian, make sure you fire up a terminal and run these commands:
sudo apt-get update
sudo apt-get upgrade
And then reboot. That should make sure that you’re on the very latest and greatest, since the image you download from the website may lag a little behind.
By “run the code as root” we generally mean “run the code as the root user/superuser account”. The “root” user has godly powers of access to all the Pi hardware that normal user accounts on the Pi can’t get at.
If you’re using IDLE or IDLE3 to do your Python coding, you should start it by first launching LXTerminal ( the black screen icon on the Pi desktop ) and typing:
for Python 2.x, or
for Python 3.x
The “sudo” command is the one that runs everything after it as root.
If you’re running a python script from the terminal, you’d do something like:
sudo python myscript.py
And boom, you’ll be running that script as root!
Good luck, and hopefully we’ll get you up and running soon!