简体   繁体   中英

Python file closes instantly in MS visual studio 2015

I am trying to run this file in MS visual studio 2015:

# This program says hello and asks for my name.
print('Hello friend!')
print('What is your name?') # ask for their name
myName = input()
print('It is good to meet you, ' + myName)
print('The length of your name is:')
print(len(myName))

I tried to run this in visual studio but after I input the "myName" field, the output window closes instantly. I tried to change the environment to Python3.4 and also IronPython, but the same result in both environments. I tried to run this file in Python3.4.2 Shell and there it works fine. Can you please troubleshoot this problem thanks

Under the "Tools", "Options" dialog, find "Python Tools" and the "Debugging" page. On that page, you can configure whether the console closes automatically or waits for a keypress for both cases where it successfully completes and when it fails (based on the exit code).

By default, on successful completion, the console will close automatically. If an error terminates the program, it will prompt by default.

For IronPython projects, the default debugger is the .NET one, which does not respect these options. In "Project Properties", "Debug" you can switch to Standard Python Debugging, which generally is a better experience (though you can no longer step into C# code).

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