pythonw.exe is a legitimate file. The process is known as ActiveState ActivePython. It is developed by Active State Software. It is commonly stored in C:\Python31\.
Pythonw.exe is an executable file that belongs to the Python, a high-level programming language which supports object-oriented, imperative and functional programming or procedural programming styles. This process runs graphical interface applications without launching a system shell.
stop program pythonstop = input("Would you like to stop the program? ")
Press Start in the lower left corner of your display; press Search; in the search window, press all files and folders; in the top textline that appears, type python.exe; press the Search button. After several minutes, the folder where Python is installed will be listed --- that folder name is the path to Python.
To summarize and complement the existing answers:
python.exe
is a console (terminal) application for launching CLI-type scripts (console applications).
Unless run from an existing console window, python.exe
opens a new console window.
Standard streams sys.stdin
, sys.stdout
and sys.stderr
are connected to the console window.
Execution is synchronous when launched from a cmd.exe
or PowerShell console window: See eryksun's 1st comment below.
pythonw.exe
is a GUI app for launching GUI/no-UI-at-all scripts.
sys.stdin
, sys.stdout
and sys.stderr
are NOT available.
print()
can cause that to happen (in 3.x, print()
simply has no effect).
pythonw.exe yourScript.pyw 1>stdout.txt 2>stderr.txt
cmd /c pythonw.exe yourScript.pyw 1>stdout.txt 2>stderr.txt
) to capture stdout and stderr output in files.print()
is the only reason your script fails silently with pythonw.exe
, and you're not interested in stdout output, use @handle's command from the comments:pythonw.exe yourScript.pyw 1>NUL 2>&1
*.pyw
scripts directly (as opposed to by passing the script file path to pythonw.exe
). See eryksun's 2nd comment and its follow-ups below.
You can control which of the executables runs your script by default - such as when opened from Explorer - by choosing the right filename extension:
*.py
files are by default associated (invoked) with python.exe
*.pyw
files are by default associated (invoked) with pythonw.exe
If you don't want a terminal window to pop up when you run your program, use pythonw.exe
;
Otherwise, use python.exe
Regarding the syntax error: print
is now a function in 3.x
So use instead:
print("a")
See here: http://docs.python.org/using/windows.html
pythonw.exe "This suppresses the terminal window on startup."
If you're going to call a python script from some other process (say, from the command line), use pythonw.exe
. Otherwise, your user will continuously see a cmd
window launching the python process. It'll still run your script just the same, but it won't intrude on the user experience.
An example might be sending an email; python.exe
will pop up a CLI window, send the email, then close the window. It'll appear as a quick flash, and can be considered somewhat annoying. pythonw.exe
avoids this, but still sends the email.
I was struggling to get this to work for a while. Once you change the extension to .pyw, make sure that you open properties of the file and direct the "open with" path to pythonw.exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With