Two Questions about Python on Windows

Tim Roberts timr at probo.com
Sat Apr 5 17:57:33 EDT 2014


maxerickson at gmail.com wrote:
>
>You can also edit the PATHEXT environment variable to include .py/.pyw,
>making the python source files executable (as long as the types are 
>properly registered with Windows; if double clicking runs them they
>should be properly registered).

Let me clarify that just a bit.

There are several ways to run Python scripts from a Windows command line.
You can invoke the interpreter specifically by name:
    C:\Apps\Python27\python xxx.py
    C:\Apps\Python27\python xxx.pyw

Or, if the Python directory is in your path:
    python xxx.py
    python xxx.pyw

If the .py and .pyw extension are registered using assoc and ftype (which
the Windows installer does), then you can invoke them by file name:
    xxx.py
    xxx.pyw

If you add those extensions to PATHEXT, then you do not even need to
provide the extension, so they will look just like any other automatically
executable program:
    xxx
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list