My original script is bigger than this, but I discovered this alone causes the exact same error. First post here (I think). So apologies if format not right.
for a in range(4000):
for b in range(200):
print('4000:' + str(a))
print('201:' + str(b))
And I get all this as errors. I'm Spyder with the Ipython console.
File "", line 1, in runfile('C:/Users/me/Documents/file.py', wdir='C:/Users/me/Documents')
File "C:\Users\me\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace)
File "C:\Users\me\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/me/Documents/file.py", line 35, in print('4000:' + str(a))
File "C:\Users\me\Anaconda3\lib\site-packages\ipykernel\iostream.py", line 317, in write self._buffer.write(string)
ValueError: I/O operation on closed file
spyder
'sexecfile
rather than your actual code. Try running it in a non-spyder terminal... – juanpa.arrivillagasys.stdout
, by any chance? What version of Ipython are you using? It may have been fixed in recent versions, and you could try just updating Ipython... – juanpa.arrivillaga