Well i am a noob to python and i can't seen to get python to do anything.
i save this as project.py: | Code: |
#file:project.py
print "hello world"
#end
|
It keeps poping up in a ms-dos window and then the window disapears.
What can i be doing wrong?!
The "ms-dos window" is probably only visible as long as the program is running. your program prints and then ends so you will have no time to see what happens. Maybe you can start an "ms-dos window" and run your program from there. That way the window will not go away when the program ends.
| Quote: |
| The "ms-dos window" is probably only visible as long as the program is running. your program prints and then ends so you will have no time to see what happens. Maybe you can start an "ms-dos window" and run your program from there. That way the window will not go away when the program ends. |
How do i do that?
I don't know Python so I don't know exactly how to do it.
I guess you use an IDE so there might be some option you can change to make the window stay. Probably easier.
I looked through the IDE, nothing was there to format the program in anyway.
Any other suggestions?
I am using python 2.4(if that's what you are asking for) but i'm not sure python has an IDE.
i am using notepad ++ as an editor if thats was you mean.
I see.. How do you execute your python program now?
i double click program.py
ah such magic
Put a raw_input at the end of the program like this:
| Code: |
#file:project.py
print "hello world"
raw_input("Press <Enter> to exit. ")
#end |
thank you sooooooooooooooooooooooo much! now i can do python!
I would also recommend getting IPython (and Console optional). (Which is basically my Python development environment along with Notepad++)
IPython is an interactive python console, that lets you run/debug your scripts as well as do things like provide help, command completion, interactive object exporer and a lot more.
Once you download, install and run it, just change to the directory where your script is and type %run script.py, or %run -d script.py to debug it.
That way you can write scripts without needing to use raw_input at the end all the time
If all this is too much a simple suggestion is just using the cmd prompt in Windows, switching to the directory with the script and typing its name.
Good luck!
The alternative way was donwload pythonwin.
It was an interactive IDE with debugger support.
http://docs.python.org/using/windows.html#additional-modules
python distribution has integrated IDE called IDLE. It is simple but enough to do basic development