Jaseman's Python Lessons


61 posts   Page 3 of 3   1, 2, 3
by Jaseman » Fri Mar 16, 2012 5:22 pm
rbn said:


Hi Jason

Which distro do you use for Python? I was on Python 2.5 in the debian distro that Liam used, but it doesn't support import argparse. I added Python 3.1 but this still doesn't work. Any help on what I need to get it going appreciated.

Great tutorial enjoyed completing all the other lessons.

Robin



I also started off on Python 2.5 following Liam's first few tutorials, but now I'm using 3.22 under Windows 7, and I'm running it on a Pentium 4.  It runs much faster not being inside Oracle VirtualBox, but I have no idea what the speed will be like, running it on the Raspberry.  The only downside of the Windows version is that Geany doesn't seem to run the programs.  You can still use it to edit them, but you have to run them from the command prompt.
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
by antiloquax » Sat Mar 17, 2012 6:39 am
Geany should work fine in Windows.

You probably need to change the build command.

With a .py file open, from the menu bar choose Build > Set Build Commands

At the bottom where it says "Execute Commands", you'll see something like "python "%f". You need to change this so that Geany knows where to look for the python executable. Depending on where you've installed it and what version you are using it'll be something llike this:

C:\Python32\python "%f"

Let me know if this doesn't work and I'll double check on a Windows machine (I'm on my Linux laptop ATM).
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
by Jaseman » Tue Mar 20, 2012 10:48 am
antiloquax said:


Geany should work fine in Windows.

You probably need to change the build command.

With a .py file open, from the menu bar choose Build > Set Build Commands

At the bottom where it says "Execute Commands", you'll see something like "python "%f". You need to change this so that Geany knows where to look for the python executable. Depending on where you've installed it and what version you are using it'll be something llike this:

C:\Python32\python "%f"

Let me know if this doesn't work and I'll double check on a Windows machine (I'm on my Linux laptop ATM).



Yep that fixed it.  Thanks very much!
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
by antiloquax » Tue Mar 20, 2012 11:57 am
:)
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
by Jaseman » Thu Mar 22, 2012 9:04 pm
Front Cover:

https://skydrive.live.com/redir.aspx?cid=f41ca64cc38a2ec5&resid=F41CA64CC38A2EC5!334&parid=F41CA64CC38A2EC5!182

I suspect there may be some copyright issues here, but I'll keep it unless Sir Clive complains!
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
by SN » Thu Mar 22, 2012 9:10 pm
recognised it instantly :-)
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1008
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by Jaseman » Fri Mar 23, 2012 3:20 pm
I've made a start on a manual.  I know 'setting up your computer' has been covered elsewhere, but I've done my own version of it anyway. Can't do much else as I don't know which IDE or text editors may be included on the Fedora SD card, or even which versions of Python and Pygame for that matter.

A zip file of what I've got so far can be downloaded here:

https://skydrive.live.com/redir.aspx?cid=f41ca64cc38a2ec5&resid=F41CA64CC38A2EC5!335&parid=F41CA64CC38A2EC5!182

If anyone fancies making a better front cover for me (In a similar style), I will consider using it and of course mention you in the preface.  It has to be some kind of space-city/sci-fi scene that will attract the attention of young budding programmers.  Preferably it will be created using some form of 3d ray-tracing/rendered model with surfaces and light/shadow effects applied, and a couple of coloured spacecraft parked up.  Perhaps something along the lines of the light-cycles from Tron, but it must be royalty-free and safe from any copyright infringements.
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
by CarlGundel » Fri Mar 23, 2012 4:07 pm
"I suspect there may be some copyright issues here, but I'll keep it unless Sir Clive complains!"

Well, the ZX81 is also a remarkable single board computer in its own right, and very small.  The Raspberry Pi of its generation.  ;-)

http://gy.orbin.se/konstruktio....._board.jpg
Posts: 19
Joined: Wed Mar 21, 2012 9:53 pm
by Jaseman » Fri Jun 08, 2012 7:57 am
I'm posting all my new Python tutorials into the Python Pit section of The MagPi magazine now.
I think the magazine format is better suited than a manual, because of the changing nature of things - especially at this early stage.

However I might compile a Python Pit book once there is enough material to justify it.
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
by computerpie » Sat Jun 23, 2012 3:42 pm
I'm getting this error when trying to execute mountains.py in Geany on my win 7 machine. Any help would be great. Here is the error I get:

Traceback (most recent call last):
File "mountains.py", line 1, in <module>
import pygame,sys,random,os,time # Just some stuff you need to setup first
ImportError: No module named pygame
Press any key to continue . . .

My system is:
Win 7 x64
Installed Geany 1.22
Installed pygame 1.9.1
Installed python 2.7 x32
Set my path in system env to c:\python27
python set to run .py files.


Works great on my Debian Squeeze desktop.
Pi1>OS: Rasbian Pi2>OS:Xbian .63
1:HDMI>>DVI>>Flat Screen Monitor
2: HDMI>>Toshiba 37" LCD
1:ASUS Wired USB Keyboard and Mouse
2:Logitech wireless mouse, CEC remote
SanDisk SDHC C4 8GB SD
User avatar
Posts: 57
Joined: Wed Jun 20, 2012 10:55 pm
Location: USA
by computerpie » Sat Jun 23, 2012 11:52 pm
During the install something (pygame) created a PythonX folder on my c drive. It had the lib and include files there. Once I moved them to the Python27 folder everything is working great.

Thanks.
Pi1>OS: Rasbian Pi2>OS:Xbian .63
1:HDMI>>DVI>>Flat Screen Monitor
2: HDMI>>Toshiba 37" LCD
1:ASUS Wired USB Keyboard and Mouse
2:Logitech wireless mouse, CEC remote
SanDisk SDHC C4 8GB SD
User avatar
Posts: 57
Joined: Wed Jun 20, 2012 10:55 pm
Location: USA