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
?
views:
30answers:
1
+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
2009-10-23 05:37:12
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
2009-10-23 05:44:43
The Mac doesn't need Pythonw anymore (since 2.3). Pythonw is only interesting for windows developers anymore.
Georg
2009-10-23 05:50:09