i've been trying to make simple programs and downloaded python 3.01. unfortunately i have no programming experience, and am a bit stuck despite searching around the tutorial, library, etc. (please forgive if this question is already answered somewhere)

my first attempt at a program is
>>>print (hello world)
hello world
when i just type it in the application, it works great. i've also figured out simple things like
but say for hello world program, how can i do it so that it executes automatically? so it automatically shows 'hello world'?

i've tried like saving it as "program.exe" in shell, but it doesn't work, 'illegal instruction' apparently.

when i just save it as "program", windows asks me what to open it with and i say python.exe, and the black screen just appears for half a second and disappears...

is it even possible to make a program so when you open it, it automatically does something?

7 Years
Discussion Span
Last Post by carapace

effbot has some nice ultra noob stuff for the beginner. See here (and you might want to check out the rest of their tutorial and then continue on with whatever on you have now) http://effbot.org/pyfaq/how-do-i-run-a-python-program-under-windows.htm

Edit: I just realized that this tutorial is for version 2.5 and lower, so it may throw some curves for someone who isn't familiar with the differences. You probably want to stick with the 3.0 tutorial that you have. Also, if you use Idle, which should have been installed along with Python, you can save and run the program from Idle, and it makes learning a lot easier IMHO. It should be under the Start-->Programs-->Python menu (or something similiar). A slightly old tutorial for Idle http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html


You might also want to check into the differences between 2.5, 2.6 and 3.0. They aren't a simple progression.

It may not be a bad idea for someone just starting out to learn on 2.5; it's what most of the tutorials, examples and libraries you will come across will be written for.


thanks, great help... that site about running a program and making executable files is quite useful...

yeah maybe i should use 2.5, so far i found one difference that it's print ("") instead of print " "

wait scru... how exactly do i keep it from exiting?
i wrote this script in shell (IDLE)

>>> print ("hello world")
hello world
>>> foo=input('Please enter a value:')
Please enter a value:

and well enough, when i try to close shell it says "The program is still running! Do you want to kill it?"

but when i save it as program.py and open it, the black screen still just dissapears after a fraction of a second...


i found the problem is not only with my script, the scripts already included also disappear after half a second

perhaps i have to turn on interpreter or something first? or maybe it doesn't work on vista?


ah alright i get it... apparently i can just run it through cmd and instead of saving the whole

>>> print ("hello world")
hello world

i only save

print("hello world")

Im in the same boat with you. very new to programing at all and feeling like a fish out of water.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.