Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python27 errno 0 and 2 in a simple for-loop printing

Tags:

python

I just used python27 to print the variable in a simple for loop. It can print out a part of the results but it stopped suddenly and appeared the errno 0 and 2 which are described as an IOerror while the process of output. I am super confused with this error

Here is my simple code:

def checkPrint():
    for i in range(0,1000):
        print i

checkPrint()

And here is the output and error:

0 . . . 287 288 289 290

Traceback (most recent call last):
File ".\checkPrint.py", line 5, in checkPrint()
File ".\checkPrint.py", line 3, in checkPrint print i

IOError: [Errno 0] Error

Thanks for your help.

like image 254
PaperElmo Avatar asked Sep 01 '25 02:09

PaperElmo


1 Answers

This may not be the asker's scenario, but I was receiving this error anytime I ran the reproduction script in Hyper 1.4.8 (with powershell.exe as my shell).

Using Command Prompt or PowerShell outside of Hyper avoided the error.

like image 183
Stephen Jennings Avatar answered Sep 02 '25 15:09

Stephen Jennings