9 Years
Discussion Span
Last Post by mn_kthompson

Okay, firstly, what are you talking about? Are you using Notepad to save your python files and that is stuffing up?
Are you using IDLE and that wont save?
Have you got a save box in your program that stuffs it up?

Please provide more information, otherwise its hard to help


I think he's talking about saving a python script and then double-clicking the file to launch it. The command dialog is closing once his program exits.

To avoid this, it is best to run the program from the terminal/cmd window

If your program has no errors and you need to verify some output, a line at the end raw_input( 'Press Enter to quit...' ) will make the program hang until the user hits 'Enter'; however if your program has an error and doesn't make it to this line, it will still close.

That is why it is best to run from the command line, or use an IDE that allows you to run your script inside the interpreter.


Just in case you dont usually run it from the command line (maybe you just double click). Here is how you would do it on windows:

First go to the start menu and choose run
type 'cmd'
press enter
using the 'cd' (change directory) function navigate to the place that your python program is in
then write in the following: python name_of_script.py


python name_of_script.py

If python is not in your path then you'll need to use the full path to the python executable, for instance: C:\Python25\python.exe myScript.py


i got a mac book for x-mas and i cant get python to down load on it


Have you tried using macports? If you get that installed then you can run port search python and get a whole list that you can chose from. Maybe try using port install python26.

This topic has been dead for over six months. 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.