Petr Viktorin <encu...@gmail.com> added the comment:

To follow up on the StackOverflow discussion: A call to PyErr_Print should 
invoke sys.excepthook. Unless sys.excepthook was changed, this should print the 
message *and* flush standard output.
If it doesn't, I recommend investigating why.

If that does not work, you can flush stderr with two function calls:

    sys_stderr = PySys_GetObject("stderr");
    PyObject_CallMethodNoArgs(sys_stderr, "flush");

plus the necessary error handling if any returns NULL, of course.

And/or the same thing with stdout. The flush_io function does exactly this (for 
both stdout and stderr).
I don't think this is general enough to expose as an API -- IMO it's better to 
be explicit and call the flush method as above.

----------
nosy: +petr.viktorin
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to