Balloon Collaboration

Raspberry Pi => Pi Programming => Topic started by: Larry on January 02, 2013, 03:32:53 AM



Title: Python 3.3
Post by: Larry on January 02, 2013, 03:32:53 AM
After getting an email from Danny about the possibility of upgrading to Python 3.3, I did a little research and eventually found this (http://quick2wire.com/2012/07/using-python-3-on-the-raspberry-pi/) page.  I explains why 3.3 is better than 2.7 for manipulating the I/O's on the pi.

I had to figure out how to use Python 3 on the Pi and found that IDLE3 is Python 3.  from the command line, you simply type python3 filename and hit enter to run the app.  I needed to reinstall the lxml library into python 3 and did it using the following command:
sudo apt-get install python3-lxml
Seems as though you handle 3 the same way as 2, except you add the 3 to the end of the python name.

BTW, the Pi is running Python 3.2.3, but I think that is close enough to 3.3 that it doesn't make a difference.  I am running 3.3 on my Windows PC for development.

The latest EveAPI app converted and working in Python 3.3... even tested on the Pi...

EveAPI2_3.py (http://barntek.net/RasPi/Python_Prgs/Python3/EveAPI2_3.txt)


Title: Re: Python 3.3
Post by: DaddyB on January 18, 2013, 02:52:12 AM
I am about to throw my Pi out the window!!
I am trying to write the blink program and when I write "import RPi-GPIO as GPIO"  I get an error message.
I will keep trying, however. >:(


Title: Re: Python 3.3
Post by: Larry on January 18, 2013, 08:03:51 AM
Well, if you are trying to write it and run it in IDLE3, then you will have to run IDLE as root, because RPi-GPIO has to be run as root.  Basically, either open a terminal window and type in sudo idle3 to launch it, or right-click on the icon and there should be a text box with the word command beside it.  Just insert sudo and a space in front of whatever is in there and click OK.

Now when you douple-click IDEL3 it will launch as root.  

If you are just trying to run it from the command line, you will have to type in sudo python3 file_name.

Don't get too aggrevated, I went thru the same stuff, too.  ;)


Title: Re: Python 3.3
Post by: DaddyB on January 18, 2013, 05:26:11 PM
Thanx.  I am about to go try it....

With your help, it is running along smoothly.  I'm still at the 'hello world' stage, but it is coming along.
I have it blinking two LED's for a predetermined count.  It prints the color LED and its associated count...
Thanks for the help.   ;D