tags:

views:

30

answers:

1

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?

+3  A: 

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

Steve Gilham
On my mac it says `/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python` (which does make perfect sense) whether I run python or pythonw.
Alex Martelli
The Mac doesn't need Pythonw anymore (since 2.3). Pythonw is only interesting for windows developers anymore.
Georg