How to tell Script to use pythonw.exe ?

Tim Roberts timr at probo.com
Tue Jul 2 23:43:44 EDT 2013


goldtech <leegold at operamail.com> wrote:
>
>I just changed the file extension of the script file from .py to .pyw
>and it uses pythonw.exe. I didn't read it anywhere, just intuited it
>and tried it. Python has some very smart people working the language...

While your statement is true, that's not what happened here.

Windows has long had the ability to associate a file extension with a
handler.  If you start a command shell, the "assoc" command tells you the
program type associated with an extension, and the "ftype" command tells
you the command line that will be executed for that program type.  On my
box:

C:\tmp>assoc .py
.py=Python

C:\tmp>ftype Python
Python="C:\Apps\Python27\Python.exe" "%1" %*

C:\tmp>assoc .pyw
.pyw=Python.NoConFile

C:\tmp>ftype Python.NoConFile
Python.NoConFile="C:\Apps\Python27\Pythonw.exe" "%1" %*

You can create your own, if you want.  If you want files with a .script
extension to run PythonW, you can type:

    assoc .script=Python.NoConFile
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list