[IPython-dev] Ipython Notebook Showing Warnings In Wrong Order
Maximilian Albert
maximilian.albert at gmail.com
Thu Jun 12 04:46:06 EDT 2014
Hi Justin,
The order that warning messages are printed in Ipython Notebooks in the
> presence of a print statement is not as expected. Take for example:
>
>
> No the order is not wrong, warning send string to stderr, print to stdout.
> Nothing guaranties the "order" in which they appear.
>
That said, you can try to flush the buffers immediately. The following
produces the expected order for me in the notebook as well:
==>
import sys
import warnings
warnings.simplefilter('always')
for x in range(10):
warnings.warn('Warning %d' % (x))
sys.stderr.flush()
print x
sys.stdout.flush()
<==
Cheers,
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140612/0fac8618/attachment.html>
More information about the IPython-dev
mailing list