Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

Whenever I enter the name of the python script alone, separate cmd window opens


  • Please log in to reply
1 reply to this topic

#1 davidc0202

davidc0202

  •  Avatar image
  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:12:12 AM

Posted 11 December 2022 - 07:22 PM

Hello! I've been having quite a perplexing problem recently.

 

Whenever I enter the name of a python script on its own at the command prompt, e.g. >abc.py, a separate terminal window opens. However, when I enter >python abc.py, it remains in the same window without opening a new one... I'm quite confused as to why this is happening. Could it be that I recently reinstalled Windows to attempt to fix recurring Bluetooth problems, and downloaded Python from the Microsoft Store instead of the Python website?



BC AdBot (Login to Remove)

 


#2 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:12 PM

Posted 22 December 2022 - 05:23 AM

I hope you have answered the question already. If not and since no one else is responding I will offer a guess. And since you say Microsoft Store I will assume this is Windows. I am not extensively familiar with Python but I do understand Windows consoles, also called command prompts, and corresponding processes.

 

I think that Python associates the py extension with py.exe and the behavior you are getting is the result of py.exe. When you execute python (it is a different program) as a command then python executes in the same console. I am not sure but I think that is a likely explanation.

 

Also see What is the difference between 'py' and 'python' in the Windows terminal? - Stack Overflow.


Edited by SamHobbs, 22 December 2022 - 05:31 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users