3

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.

2
  • Are you sure VS Code is set up to use python 2.7? Commented Apr 7, 2018 at 0:47
  • yes ! and I got the output for certain value of i then exit running with the above error Commented Apr 7, 2018 at 3:28

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Im using windows 10 but I have run it using IDLE and it is working fine. I just got the error when I run it using VS Code only

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.