[Tutor] pyce, scripts complete too fast

Dave Angel davea at ieee.org
Tue Nov 17 14:27:58 CET 2009

rick wrote:
> Perhaps the wrong list, but I'll ask anyway.  So I'm in the middle of
> starting, yet again, to learn some programming.   I have 2.6.4 and 3.1
> installed on the desktop (Ubuntu 9.10), 2.6.4 installed on the netbook
> (UNR 9.10).   
> I was thinking to be ultra portable, I'd put python on the pocket pc.
> Now I'm back to the problem that a Windows newbie would have, the
> scripts complete before I can see what happened!  I can get right to the
> interactive mode, or I can run a script, but not sure where I'd find the
> terminal.
> Thanks Alan, I was going through your old tutorial, the pointer to the
> new was appreciated.
> Rick
On Windows, you can get a terminal window (aka DOS box)  by running 
"Command Prompt" from your Start menu (In recent versions it seems to be 
in Start->Accessories).   You can copy that shortcut elsewhere, of 
course.  Or you can run CMD.EXE from anywhere, like the Run menu or 
another DOS box.

Once you have a DOS box, you can set local environment variables, run 
batch files, or do other preparations before beginning your python 
program.  And of course when the python program finishes you can still 
see the results (with some amount of scrolling, buffer size can be 
adjusted).    And once you're in a DOS box, you can get two independent 
ones by running Start from the first.   The new one inherits environment 
variables and current directory from the first, but does not block the 
first one from taking new commands.

You can also create a shortcut that starts a new DOS box, AND runs your 
program.  I haven't done this in so long that I forget the syntax.  But 
it's something like
        cmd.exe  /k  python.exe   script.py

By using the right switch on cmd.exe, the DOS box doesn't go away when 
the python program exits.

By the way, you can get rid of a DOS box by typing EXIT at its prompt, 
or by clicking the X on the upper right corner of the window.



More information about the Tutor mailing list