On Mac OS X, both 'python' and 'pythonw' exist as commands, but 'pythonw' needs to be called for any wxPython app run from the command line.
The code sample below when called from a main script checks whether the script is running from within a Mac OS X app bundle. If not, it re-rexecutes the same script with the same arguments using pythonw.
It's simple, but useful for distributing cross-platform apps that can be run from the command line.
import sys,os def reexec_with_pythonw(): if sys.platform == 'darwin' and\ not sys.executable.endswith('MacOS/Python'): print >>sys.stderr,'re-executing using pythonw' os.execvp('pythonw',['pythonw',__file__] + sys.argv[1:])