Ask Your Question

Revision history [back]

printing far later than the actual print statement

I have some code in a jupyter notebook which takes some time to run. When I run it, it does multiple calculations in which between there are print statements such that I can see certain results. Now the thing is that it sometimes chooses to wait with revealing the results of print statements. With this I mean:
My code first prints some results, then 20 seconds later it prints a lot more result. But I added the current time to all my print statements, which reveals that most of them could have been shown less than a second after the first results were printed. This makes sense since it finishes off with calculating a groebner basis, which takes longer than any of the other calculations, but I don't know why it wouldn't show any of the print statements which are done before the groebner basis calculations start.
Is there a way to make certain that it immediately prints instead of waiting until a later step of the program?