SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-07-18 22:17:33

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

[solved] Programming python on #! what do i need?

Hi, i want to learn programming in python, i think its an interesting programming language.
I have a little knowlage from youngerdays with basic, i find python a bit simular as basic.

Iam writing test codes in geany but i dont know what more i need to run things.
i made a number guess game and named it game.py .
But what do i need to download to try the "game".

What are you recommending to download to start programming in python on #!?

Last edited by Tim (2012-07-18 22:52:11)


Crunchy feeling #!

Offline

Help fund CrunchBang, donate to the project!

#2 2012-07-18 22:22:38

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: [solved] Programming python on #! what do i need?

Hi, Tim smile

Type this in a terminal:

python

If that takes you to an interactive python console, you're good to go. Run the program like so:

python yourscript.py

i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

#3 2012-07-18 22:23:34

Eren
#! Die Hard
From: Black Mesa
Registered: 2009-07-27
Posts: 830

Re: [solved] Programming python on #! what do i need?

I didn't understand what you're going to download and why you need to download anything, just chmod +x game.py and python game.py to try it from your terminal. Nothing more you need. If you need deeply libraries on python gaming just apt-get install python-pygame.

I hope this helps.

Offline

#4 2012-07-18 22:28:21

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

thanks for the feedback, i will try both tips, just to see whats fits me the best smile

if i go to the python console, and trying to run a .py file, doesent i need to locate it somehow first?
Sorry if i ask dumb questions, but i have to start sometime from the begining!


Crunchy feeling #!

Offline

#5 2012-07-18 22:32:02

Eren
#! Die Hard
From: Black Mesa
Registered: 2009-07-27
Posts: 830

Re: [solved] Programming python on #! what do i need?

I think you can't run a .py file from python console. Just python ....py to run it.

Offline

#6 2012-07-18 22:33:17

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

when i try to cd somewhere ive got some troble sometime.
if i write in terminal

cd /home/tim/

there is no problem, but if i want to cd to a folder in /home/tim/python (python is the folder in /tim)
it just tells me it does not exist, dont know english terms from terminal caus its in swedish for me.
Think iam going to change that, caus iam trying to use only english on this notebook.


Crunchy feeling #!

Offline

#7 2012-07-18 22:34:36

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

Eren wrote:

I think you can't run a .py file from python console. Just python ....py to run it.

Thanks, thats what i thought too, i think i just missunderstod it a bit.


Crunchy feeling #!

Offline

#8 2012-07-18 22:36:36

Eren
#! Die Hard
From: Black Mesa
Registered: 2009-07-27
Posts: 830

Re: [solved] Programming python on #! what do i need?

Are you really sure that it's a folder? Because it has to enter if it's a folder. Have you got any screenshot to show us, with your terminal of course.

And a tip for you, if you write cd /home/tim and double tap tab button, it'll show a list of folders you got to enter.

Last edited by Eren (2012-07-18 22:39:05)

Offline

#9 2012-07-18 22:44:13

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

Eren wrote:

Are you really sure that it's a folder? Because it has to enter if it's a folder. Have you got any screenshot to show us, with your terminal of course.

And a tip for you, if you write cd /home/tim and double tap tab button, it'll show a list of folders you got to enter.

The tab-button is just wonderful, use it all the time. Thanks anyway for a really good tips.
here you go with my screenshots;
terminal:
tZXNkbg

folder in thunar:
tZXNkbw


Crunchy feeling #!

Offline

#10 2012-07-18 22:46:28

Eren
#! Die Hard
From: Black Mesa
Registered: 2009-07-27
Posts: 830

Re: [solved] Programming python on #! what do i need?

Try to "cd Python". And you don't need your user folder to write again. smile It's p and P problem. smile

Offline

#11 2012-07-18 22:48:22

pidsley
Window Mangler
Registered: 2012-05-23
Posts: 1,752

Re: [solved] Programming python on #! what do i need?

The folder is called "Python" and you're trying to cd into "python" -- linux is case sensitive. Try to cd into "Python"

(edit) eren types faster

Last edited by pidsley (2012-07-18 22:48:46)

Offline

#12 2012-07-18 22:50:31

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

Eren wrote:

Try to "cd Python". And you don't need your user folder to write again. smile It's p and P problem. smile

Hey, the double tap on the tab-button was new, i just know single tap before. Awesome,  just love the terminal more and more. And for the python game, it has some problem with the code tongue
think iam going to try to solve it tomorrow.

anyway, i made it to get in to the folder!

Thanks for the help smile
and how to start python stuff from terminal is now solved to! THanks again #!-buddies


Crunchy feeling #!

Offline

#13 2012-07-18 22:51:48

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

pidsley wrote:

The folder is called "Python" and you're trying to cd into "python" -- linux is case sensitive. Try to cd into "Python"

(edit) eren types faster

The strange thing is that i tested with a big P also, with same results.
But i think i got it sorted out now smile

Thanks for the help!


Crunchy feeling #!

Offline

#14 2012-07-18 22:52:20

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: [solved] Programming python on #! what do i need?

Tim wrote:
Eren wrote:

I think you can't run a .py file from python console. Just python ....py to run it.

Thanks, thats what i thought too, i think i just missunderstod it a bit.

My bad, I wasn't clear there. I meant for you to exit the python console (with quit() or CTRL+D) first, then try the python yourscript.py command.


i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

#15 2012-07-18 22:59:04

pidsley
Window Mangler
Registered: 2012-05-23
Posts: 1,752

Re: [solved] Programming python on #! what do i need?

Tim wrote:

Thanks for the help smile
and how to start python stuff from terminal is now solved to! THanks again #!-buddies

Tim, if you haven't seen Learn Python the Hard Way you might want to check it out (you can read it online for free), or just search this forum for "python" and you'll get some other good tips for books and other resources.

Last edited by pidsley (2012-07-18 22:59:24)

Offline

#16 2012-07-18 23:01:27

Eren
#! Die Hard
From: Black Mesa
Registered: 2009-07-27
Posts: 830

Re: [solved] Programming python on #! what do i need?

^ Yep, great source. Another one is http://inventwithpython.com

Offline

#17 2012-07-18 23:10:16

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

Thanks for the tips, iam reading a book called "Oreilly - Head First Programming (12-2009)"
He writes in quite a fun way, i really like that book soo far. He explains in a easy way, pretty good.
ive got it in a pdf smile

I will check out your links tomorrow.


Crunchy feeling #!

Offline

#18 2012-07-18 23:11:23

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: [solved] Programming python on #! what do i need?

The Head First books are great smile


i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

#19 2012-07-18 23:38:53

lcafiero
The #! Guy
From: Felton, California, USA
Registered: 2011-07-21
Posts: 2,196
Website

Re: [solved] Programming python on #! what do i need?

"Learn Python the Hard Way" is a good book. I taught Python to kids using a book called "Snake Wrangling for Kids" -- I don't have a link for it, but if you search for it you can find a link for the PDF file. It's good -- you don't have to be a kid to get something from it, and I used it when I first learned Python a few of years ago, around the time I turned 50 (Old Kid -- "How's it goin'?").


Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang

CrunchBang Forum moderator

Offline

#20 2012-07-19 08:04:59

skbierm
#! Member
From: Germany
Registered: 2012-07-17
Posts: 82

Re: [solved] Programming python on #! what do i need?

Also you can use the OCW  of the MIT. There is a brilliant course "Introduction to Computer Sciences". You have 24 video courseparts and all the course stuff online, including the books - and learn Python while following the course.

http://ocw.mit.edu/courses/audio-video- … er-science shows all the computer courses, you can take either 6.00SC, from Professor Guttag only, or the older course 6.00 from Professor Grimson and Professor Guttag.

After you took one of those courses, 6.01SC would be a follow up course

Last edited by skbierm (2012-07-19 08:05:45)


Running #! on
* Lenovo ThinkPad Edge e420s, Intel Core i5-2430M, 8 GB Ram, 320 GB HD, 1366x768, Intel GMA HD 3000 + AMD Radeon HD 6630M 2GB
* ASUS F55A-091D, Intel Pentium B980, 4 GB Ram, 500 GB HD, Intel HD Graphics, 1366x768
* Panasonic ToughBook CF-19, Intel Core Duo U2400, 4 GB Ram, 320 GB HD, Intel GMA 950, 1024x768 Touchdisplay

Offline

#21 2012-07-19 10:08:17

Tim
#! CrunchBanger
From: SWeden
Registered: 2012-07-09
Posts: 149

Re: [solved] Programming python on #! what do i need?

Ah, thanks again, now i have some more good pdf:s, the kid pyhonbook looks fun too smile
Video tutorial , i will check that up!! Paper and pen is very very handy!

Is idle3 (python shell) any good, and what is it exactly?


Crunchy feeling #!

Offline

#22 2012-07-19 19:16:27

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: [solved] Programming python on #! what do i need?

^ Idle is an IDE bundled with Python. More info here.

I would stick to a regular text editor (with syntax highlighting) to keep things simple at the start - you can move to an IDE or something else as you discover more features you need.

Last edited by safetycopy (2012-07-19 19:16:39)


i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

#23 2012-07-19 20:38:36

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 3,407

Re: [solved] Programming python on #! what do i need?

safetycopy wrote:

^ Idle is an IDE bundled with Python. More info here.

I would stick to a regular text editor (with syntax highlighting) to keep things simple at the start - you can move to an IDE or something else as you discover more features you need.

I found idle to be much easier to use than a simple text editor, because of the syntax highlighting and code testing. It's certainly simpler than full-blown IDEs I agree, but wasn't a problem for a python noob like me smile

A more important concern may be whether to learn python3 or not, since a lot of python2x code is now deprecated. (There is idle3 as well)


Artwork at deviantArt;  Iceweasel Personas;  SLiM #! Themes;  Openbox themes

Offline

#24 2012-07-19 20:46:08

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: [solved] Programming python on #! what do i need?

^ That's largely a matter of circumstance: http://wiki.python.org/moin/Python2orPython3


i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

Help fund CrunchBang, donate to the project!

#25 2012-07-20 06:11:10

Awebb
The Singularity
Registered: 2009-07-23
Posts: 2,812

Re: [solved] Programming python on #! what do i need?

I can recommend three things:

1. this book.
2. Do not use an IDE unless you are a capable programmer. Instead of helping you aquire a good style, complex IDEs teach you more about laziness and hide essential parts of the learning curve from your novice eyes. Stick with a good text editor like gedit, geany, vim or emacs and use the minimal IDE capabilities embedded in those editors for your convenience.
3. Turn off the auto intendation of your text editor. Python is intendation sensitive, the more you are aware of that from the beginning, the better you will be able to write and read code in the future.

EDIT:

With no "IDE", I meant complex environments with hand holding and automated everything. Geany is an IDE as well, but it doesn't attempt to cook you dinner in the middle of the night.

Last edited by Awebb (2012-07-20 06:12:33)


I'm so meta, even this acronym

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo