[Tutor] EXE Problem
Dave Angel
davea at davea.name
Wed Jun 19 09:10:38 CEST 2013
On 06/19/2013 02:50 AM, Jack Little wrote:
> I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes.
>
It compiles when you run it, so it's not clear what extra step you're
describing here.
Quite a bit of missing information here, so let's do some guessing.
You're running some version of Windows?
You're running Python 3.3 ?
You're launching what you think is a useful program, directly from
Explorer, using double-click, or with right-click-OpenWith ?? Python
programs don't have an EXE extension, so perhaps you're not actually
double clicking on the right thing. Or perhaps you've neglected to
change Windows brain-dead default of NOT showing file extensions in
Explorer.
When a non-GUI program starts from Explorer, Windows helpfully creates a
command window, then helpfully destroys it before you can read the
results if any.
If you know your program is correct, and you just want to see the
output, you'll need to put some form of pause at the end of your
program. This could be a sleep(3) if you're a speed reader, or it could
be just an input() statement.
But if the program is flawed, such as a syntax error, you might never
reach the pause. So you might as well get used to the following:
Run your program at a cmd prompt, inside a "DOS Box", or "Command
Window", or one of several other names used in various Windows versions.
It's actually a shell, but Windows doesn't use that term.
--
DaveA
More information about the Tutor
mailing list