简体   繁体   中英

IOError: [Errno 0] Error when running python code using visual studio code

I'm very new to Visual Studio Code even beginner in python coding. I have tried the following very simple code:

for i in range(1000):
    print i

Each time I run the code I got the following error after printing some of i's:

print i

IOError: [Errno 0] Error

I'm using python 2.7

Your help on this is highly appreciated. Thanks.

After researching on the web about it, it appears to be a Windows issue which has been resolved in the Windows 1803 release. See https://github.com/Microsoft/vscode/issues/36630#issuecomment-357084696

Edit :

A workaround is to use external instead of redirected terminal.

Add the line:

"console": "externalTerminal",

to your launch.json .

It looks like there is a problem with input/output. Try to run it from cmd or bash if you are on Ubuntu.If that doesn't work try from Python IDLE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM