Home > front end >  Python opens new windows to run script?
Python opens new windows to run script?

Time:11-26

print("test")
m = input("Name: ")
print(m)

I was getting ready to start programing. I opened cmd and ran my program and it opened a new cmd and printed out my code. Why is python opening a new cmd window to run my script unstead of using the cmd that was opened?

Also I recently updated python to python 3.10

CodePudding user response:

When you type the name of a file, and the program associated with the file type is a console application (like python.exe) then Windows will open a new console window to run the application. When the application closes, the command window will close automatically.

You can get around this by opening Python yourself in the current console:

python -m response.py

CodePudding user response:

I'm very slow, so yes for whatever reason you now have to type python3 C:\Users\johm\Desktop>python3 reponse.py

This worked

  • Related