Python is easy?

Patrick Ellis pellis at tampabay.rr.com
Thu Aug 15 06:31:20 CEST 2002


"Christopher" <chris_mk at hotmail.com> wrote:
> Having said that, here is what I recommend you do to run your script.
> Open a console (I am assuming you have a Wintel system).  cd to the
> directory containing your test1 module.  Then type in your full
> python.exe path then your full module name (on my Wintel it is,
> C:\Python22\python.exe test1.py).

In my experience, the Windows install for Python sets up the registry so
that *.py files are recognized as Python scripts. Typing "test1.py" (note
that the .py is important) will run the installed Python with the test1
script. This is similar to running a .exe, except for the required
extension. There is no need to know where python.exe is, or put it in your
path, unless you explicitly want the interactive prompt.

Double clicking a *.py file in explorer will also run the script, as above.
Again, just like a .exe. The drawback is that the DOS shell that appears,
will disappear as soon as the program exits, whether normally or due to an
error. It would be nice if someone out there knew how keep the window up
after exit, especially due to a compile error. I use sys.stdin.readline() at
the end of many scripts to force a CR to end the script and close the
window, but this doesn't help the error cases.





More information about the Python-list mailing list