Search code examples
pythonpythonw

Determine if a script is running in pythonw?


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?


Solution

  • sys.executable -- "A string giving the name of the executable binary for the Python interpreter, on systems where this makes sense."