Running Scripts vs Interactive mode

scattered tooscattered at gmail.com
Thu Feb 24 11:39:13 CET 2011


On Feb 23, 5:22 pm, grobs456 <gregory.alexander.robe... at gmail.com>
wrote:
> Hi,
>
> I am trying to work through the tutorial at:http://docs.python.org/tutorial/
>
> The issue I am facing is with regards to the discussion about
> "Invoking the Interpreter" and "Executable Python Scripts". It was
> rather hazy in my opinion.
>
> see:http://docs.python.org/tutorial/interpreter.html
>
> I realize I can double click on a .py file and Windows treats it as an
> executable but the command prompt pops in and out so quickly that I
> can't see the results of my script.
>
> I would prefer to follow along with the tutorial, compiling new ticks
> and topics into a growing .py file, that I error check of course(in
> case the same variables are used throughout the tutorial), and then
> run that file to see the results as if I would have typed each line in
> one at a time. This way I have something usable to refer back to for
> learning purposes and for future coding projects instead of having to
> rely on the tutorial itself for my reference moving forward. Any
> ideas?
>
> Python is installed at:
> C:\Python27
>
> and I ran:
> set path=%path%;C:\python27
>
> #do i have to run the above each time I open up a session?
> #Also, note that  I do not see the any system environment variables
> get updated when I run the above.

Greetings,

I too have been learning Python on Windows in recent months. I have
found using IDLE more than adequate for my purposes. When you right-
click on a .py file "Edit with IDLE" is one of the options (if you
have a standard Python install). Selecting "run" from IDLE opens up a
Python shell and runs the script. Alternatitively, you can open IDLE
directly then load your script into it. Unless you need to directly
enter Windows commands at a DOS prompt, running scripts from IDLE's
Python shell makes for a superior command line for Python, since it is
syntax aware (e.g. helps with code indentation) and allows for easy
cut-and-paste of previously typed commands. IDLE is a bit clunky
compared to commerical IDEs, but is excellent for doing quick
experiments.



More information about the Python-list mailing list