I can consistently reproduce a bug in 2.7.15 on Windows which causes an unexpected IOError. Steps to reproduce: Enter the following code in a plain-vanilla windows command line console: >>> import sys >>> while True: ... sys.stdout.write('.') Then, pause the output, either by clicking and holding the scrollbar for 10 seconds, or by highlighting text with the mouse for 10 seconds and then pressing 'enter' to un-highlight. Upon resuming, the following error is seen: Traceback (most recent call last): File "", line 2, in IOError: [Errno 0] Error
This may be the same problem as issue 32245, which was a third-party bug that Microsoft fixed in the last Spring update of Windows 10. Which version of Windows are you using?
With Windows 10 release 1803, I can't reproduce either this problem or the problems from issue 32245. I'm marking this issue closed as a duplicate. Open a new issue if you still experience the problem after updating to Windows 10 release 1803 or 1809.