IDLE doesn't show stderr output from extension modules
Robert Kern
robert.kern at gmail.com
Fri Dec 19 18:39:51 EST 2008
Brian Cole wrote:
> I'm importing an extension module created with SWIG. When working with
> the module interactively in IDLE there should be warning and error
> messages printed to stderr by the extension module. However, these are
> not being caught by the IDLE window, they are going directly to the
> terminal that was used to start IDLE.
>
> Strange, because sys.stderr.write() does print to the IDLE window.
> I've tried this on Windows and OSX, so it doesn't appear to be a
> platform issue. Is this just a fundamental deficiency in the IDLE
> shell prompt?
Yup. IDLE swaps out the sys.stdout and sys.stderr objects at the Python level.
It does not replace the STDOUT and STDERR C file pointers. Python code and C
extension modules which use the Python APIs to write stuff out should get
redirected, but extension modules that use fprintf(), etc., directly to STDOUT
and STDERR won't.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list