Duplicated lines in IDLE output

A friend of mine is using Python to solve a research problem. Their setup is a bit unconventional - IDLE on Windows - but it’s what works for them.

After adding some logging, we noticed that sometimes, the lines being printed to the IDLE console are duplicated. The code does nothing special:

# make it known that we found a better solution
print(i, step, j, maxs, len(vs))
print(' '*indent, vs[b], fs[b], max(fs))
print(' '*indent, mins)

But sometimes, in addition to the three lines, we see previously printed lines appear again. I’m sorry for the quality of the screenshot; that’s all I have for now:
duplicated-output

The problem is made even worse by the fact that it only happens on one out of three computers. Where does one even start debugging things like that?

I am an IDLE maintainer and a) I have never see that problem and b) it is really nasty. I have no idea at the moment how it is possible. Has your friend at least tried rebooting? Is it always the same print statement whose output is duplicated? Or does each print statement randomly get duplicated? What happens if print statements are combined to print more than one line at a time? print(, ‘\n’, <2nd line stuff>).

Dear Terry Jan Reedy,

Thank you for the swift reply!

I think I was too hasty to write here. Once we rebooted the computer, we couldn’t get the problem to reappear. I suppose it should be possible to chalk it up to hardware, broken state somewhere inside the operating system, or gremlins. I’ll make sure to mention you if the problem comes back and we get more experimental data answering your other questions.

I am likely older and more experienced than you two are with glitches that disappear with a reboot, and yes, I run Python on Window also, and had just re-experienced this a couple of weeks ago. Good luck continuing.