Leith Bade schrieb: > I would like to know whether my GUI program is being run under python or > pythonw. > > I would like to know this so I can redirect stderr when their is no > console window (pythonw) otherwise leave it spitting to the console > window (python). > > This is because I debug using python while the customer release build > uses pythonw. > > I can see their is sys.executable but a google search turned up various > discussions on what this actually means (e.g when run under an > integrated exe file - which we do for our release builds).
You can check the file descriptor number of sys.stderr. If sys.stderr.fileno() returns -1 or any other value smaller than zero than stderr is not connected to a stream. Christian -- http://mail.python.org/mailman/listinfo/python-list