IDLE doesn't show stderr output from extension modules

Discussion in 'Python' started by Brian Cole, Dec 19, 2008.

  1. Brian Cole

    Brian Cole Guest

    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?

    -Brian
     
    Brian Cole, Dec 19, 2008
    #1
    1. Advertising

  2. Brian Cole

    Robert Kern Guest

    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
     
    Robert Kern, Dec 19, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vin Jovanovic

    Python 2.3 IDLE doesn't show on Win2000

    Vin Jovanovic, Aug 2, 2003, in forum: Python
    Replies:
    1
    Views:
    324
    Andy C
    Aug 2, 2003
  2. Anand
    Replies:
    3
    Views:
    901
    Tim Daneliuk
    Nov 8, 2003
  3. Porky Pig Jr
    Replies:
    0
    Views:
    289
    Porky Pig Jr
    Aug 19, 2004
  4. Porky Pig Jr
    Replies:
    3
    Views:
    447
  5. Dominique
    Replies:
    3
    Views:
    265
    Dominique
    Sep 14, 2007
Loading...

Share This Page