I would like to redirect stderr
and stdout
to files when run inside of pythonw
. How can I determine whether a script is running in pythonw
or in python
?
sys.executable
-- "A string giving the name of the executable binary for the Python interpreter, on systems where this makes sense."