2

The below python code works perfectly well in Visual Studio and Python IDLE. But when I write it in VISUAL STUDIO CODE, all the 4 print commands that come after the input value are not processed.

print ('hello world') 
print ('hello world') 
message = raw_input ('type message ') 
print ('message') 
print ('statement 1') 
print ('statement 2') 
print ('statement 3') 
print ('statement 4') 

For example, when I fill in the input with "my message", it just prints:

hello world
hello world
type message 
my message

And doesn´t execute the 4 print commands that come after the input. The expected output would be:

hello world
hello world
type message 
my message
statement 1
statement 2
statement 3
statement 4

Any idea why Visual Studio Code does not process the remaining 4 print commands?

3 Answers 3

1

It works fine with my VS. One thing I think you are trying to do is to print user input with this command.

print ('message')

so it would be

print message

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

1 Comment

Thanks guys, for your contributions. In fact, the error is not in the code, but in the fact that VSC does not support direct input from the output window. I just figured out the solution. See below ....
1

I just found it out myself. The Debug Console does not support programs that need to read input from the console, but you can enable an external, native console by setting the attribute externalConsole to true in your launch configuration. launch.json - "externalConsole" : true

Comments

0

Isn't there a plugin you could add to VS Code to strictly code in Python? Also ... I strongly suggest using Adobe Brackets. I use it as my main tool when programming anything. Brackets

Comments

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.