Getting Started with Python

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
stevoomba
Posts: 76
Joined: Thu 05 May 2005, 08:14
Location: Rye Park NSW
Contact:

Getting Started with Python

#1 Post by stevoomba »

Hi,

I'm just at the start of trying to learn programming, and Python is my first language. I started by installing Python-3.pet, but when I tried executing a .py file in Geany I got an "invalid python installation" error. I tried to find more stuff I needed to put on my computer, but info and downloads seem old or non-existent.

I thought we could perhaps use this thread to bump the Python how-to up to the present and have some new resources for 3.2 available from here.

Steve

Added Sept 11, 2011:
At Sunburnt's suggestion I got Python 2.x running with the devx file (for Lupu511), and that got me started in a shell screen okay. But when I typed my first line and pressed Enter to go to the second line it ran the code.

What am I missing?

I started learning with Idle, which gives you a separate window you can code multiple lines in. So for now I've installed Active Python, which has Idle. However I'd be interested to hear how you do code without Idle.

Anybody?

regards and thanks,
Steve
Last edited by stevoomba on Sun 11 Sep 2011, 00:38, edited 2 times in total.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#2 Post by Lobster »

Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
stevoomba
Posts: 76
Joined: Thu 05 May 2005, 08:14
Location: Rye Park NSW
Contact:

#3 Post by stevoomba »

Lobster wrote:Install slacko + devx
Does that mean I can't just run a devx sfs in my current lucid puppy?

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#4 Post by Lobster »

. . . not so far . . . :?
I get an "invalid python installation" error.
again you need to confirm the Lucid devx has a working Python
from someone using it (which is not me) :oops:
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

I got the version ( capital V ) by typing: python -V
And I got help with: python --help
Perl`s in there too.
I`m running Puppy511 with the devx file.

User avatar
stevoomba
Posts: 76
Joined: Thu 05 May 2005, 08:14
Location: Rye Park NSW
Contact:

#6 Post by stevoomba »

sunburnt wrote:I got the version ( capital V ) by typing: python -V
And I got help with: python --help
Perl`s in there too.
I`m running Puppy511 with the devx file.
Thanks Sunburnt. I'm running 511 too. I'll get the devx file. (I wanted to be sure because like Barry I'm on satellite broadband which is very lean on the monthly gigabytes... I'm not holding my breath for the fibre rollout.)

Steve

User avatar
stevoomba
Posts: 76
Joined: Thu 05 May 2005, 08:14
Location: Rye Park NSW
Contact:

#7 Post by stevoomba »

I got Python 2.x running with the devx file okay, but I couldn't work out how to do code in a separate window like using Idle in Windo$e.

So I ended up downloading Active Python. It includes Idle, which is what I started learning on so I'll stick with that for now.

Chinchillagorilla
Posts: 4
Joined: Mon 20 Sep 2010, 09:30
Location: London, UK

Bamboozled trying to run Python with Geany.

#8 Post by Chinchillagorilla »

I'm in a similar position. I'm working through Invent Your Own Games With Python using IDLE on Windoze. I've installed a .pet for Python 3.2 on Puppy 511.

In IDLE the code goes in the shell and it's run in a new window. When I execute in Geany a small window momentarily flashes then instantly disappears and that's it.

What step am I missing here?
:cry:

Chinchillagorilla
Posts: 4
Joined: Mon 20 Sep 2010, 09:30
Location: London, UK

Bamboozled

#9 Post by Chinchillagorilla »

So, Geany is not recognising the import command, the first line of the script. Do I need to set the Make Path...?

Geany isn't compiling Python?

Also in the console when I type python I get 3.2, but if I try to import random I get a message saying there's no math module??

I could try out Active Python, but Geany should work (shouldn't it?).

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#10 Post by technosaurus »

Iirc shell scripts had a similar issue, perhaps the solution is similar.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
faifpuhp
Posts: 97
Joined: Thu 22 Sep 2011, 06:12

#11 Post by faifpuhp »

I'm probably not going to be much help here, because I figured Puppy (given its size) would have to neglect Python, and so the first thing I tried to do when I booted up was install it.

Went without a hitch, but that's the basics, I don't know what it would take to install say, pygame, but I've managed that before without help and I bet I could again.

The reason I probably won't be of much help is I just code in a plain text editor, not an IDE, and then run from the bash shell.

That works fine. IDLE doesn't even support some of the features I like most in Python (curses for example,) so it's not of much use to me, but I'm really glad I'm not the only person here who loves Python. (I like Bash, too.)

If I figure this one out for you I'll post again here.
[url=http://murga-linux.com/puppy/viewtopic.php?p=566477#566477][b]Strawberry is dead[/b][/url][b]![/b]

topaz
Posts: 132
Joined: Thu 14 Dec 2006, 20:18
Location: Northumberland UK

#12 Post by topaz »

Hi
I just use the devx file Code in Geany and run" python file name.py" in the console. Make sure you run in correct directory i just open the directory i have my py file in and hit the ¬ key and the console will open in the corect directory.

Post Reply