Is there a difference between python <script>.pyw and pythonw <script>.py?
Eryk Sun
eryksun at gmail.com
Mon Apr 6 02:19:35 EDT 2020
On 4/5/20, Malcolm Greene <python at bdurham.com> wrote:
> Is there a difference between the following 2 ways to launch a console-less
> script under Windows?
>
> python <script>.pyw
> pythonw <script>.py
The file extension is only a factor when the command line executes the
script, not when it runs Python directly. The first case executes the
script via python.exe, which inherits or allocates a console. The
second case uses pythonw.exe, which does not inherit or allocate a
console.
The default file association for ".pyw" scripts runs the template
command `"path\to\pyw.exe" "%1" %*`. "pyw.exe" is a GUI launcher that
executes and waits on "pythonw.exe". The selected version depends on
an active virtual environment and any "-X[.Y][-32|-64]" version
specification passed on the command line or in the script's shebang.
More information about the Python-list
mailing list