Running Scripts vs Interactive mode
davea at ieee.org
Thu Feb 24 03:31:46 CET 2011
On 01/-10/-28163 02:59 PM, Ben Finney wrote:
> grobs456<gregory.alexander.roberts at gmail.com> writes:
>> 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.
> Don't do that, then :-)
> You can open a persistent terminal window, and run the program from the
> command line.
You get at least three other benefits: You can specify arguments
(available in sys.argv) for each run, to test the program in various
ways. And you can see earlier runs on the screen, and scroll back an
arbitrary (configurable) amount to see what changed. And you can
copy/paste that output elsewhere, like to an email if you have a question.
>> and I ran:
>> set path=%path%;C:\python27
>> #do i have to run the above each time I open up a session?
The value will survive within the one command window, and any other
command windows you start from it. But if you want that value to be
available on all (new) command windows, you set it in the Control Panel.
It's been a while since I ran Windows, but it was someplace like
System->EnvironmentVariables) Once you do that, it'll not only be
available in any new DOS sessions, and any application that's run from
Explorer, but also will survive a restart.
More information about the Python-list