This works for some, but not for *all* stderr output. In particular, if I create some OGL objects and assign non-existing fonts to them, the following messages are sents to the command line:
** (HMMBuilder.py:7512): WARNING **: Couldn't load font "Times New Roman 10" falling back to "Sans 10"
That is, the messages above apparently don't get processed by the call to wxLogMessage in the class LogRedirect. If OTOH I redirect stderr on the command line and start the program with something like
python HMMBuilder.py >& somefile
then the messages above get sent to somefile. How can I capture those stderr font messages directly in the application?
I am using python 2.3.2 and wxPython 2.4.2.4 on linux.
This works for some, but not for *all* stderr output. In particular, if I create some OGL objects and assign non-existing fonts to them, the following messages are sents to the command line:
** (HMMBuilder.py:7512): WARNING **: Couldn't load font "Times New Roman 10" falling back to "Sans 10"
That is, the messages above apparently don't get processed by the call to wxLogMessage in the class LogRedirect. If OTOH I redirect stderr on the command line and start the program with something like
python HMMBuilder.py >& somefile
then the messages above get sent to somefile. How can I capture those stderr font messages directly in the application?
Those messages are coming from the C++ code (the "HMMBuilder.py:7512" is the process name and pid, not a file and line number) so the output is bypassing the Python streams and going directly to the C stdio/stderr streams. There may be a way to capture those from Python by doing low-level tricks with the file handles, but I've never tried it.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!