rainer
rainer

Reputation: 3411

VS Code not processing python print commands after input

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?

Upvotes: 2

Views: 2463

Answers (3)

rainer
rainer

Reputation: 3411

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

Upvotes: 1

Baba
Baba

Reputation: 47

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

Upvotes: 1

Robert Dewitt
Robert Dewitt

Reputation: 324

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

Upvotes: 0

Related Questions