0

I had this script for automated solving of a little daily game thing. I used to be able to run it by typing cmd into the folder where the script was, and then running the script by entering scriptname.py into the command prompt.

But I tried to install Python for something else unrelated and now when I try to run my script, a Python window pops up for a split second and then disappears, and nothing happens in the command prompt. I tried to uninstall Python, but trying to run the script just installed Python again.

How can I fix this so I can just run the script the way it worked before?

New contributor
russia is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • unfortunately didn't help, I get this error: Traceback (most recent call last): File "C:\Users\Admin\Documents\folder\scriptname.py", line 3, in <module> import pyautogui ModuleNotFoundError: No module named 'pyautogui' which, I've never gotten before so is it an issue with the script? Commented Nov 16 at 7:19
  • I may just reinstall the script :( seems there have been changes since the last time I installed it Commented Nov 16 at 7:21

1 Answer 1

1

Open cmd in your script's folder (as before: in File Explorer, click the address bar, type "cmd", and press Enter).

Instead of typing just scriptname.py, type this exactly (replace scriptname.py with your actual file name):

python scriptname.py

Press Enter. The script should now run directly in the current cmd window, without popping up a new one that disappears

New contributor
Eric Håkansson is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Sign up to request clarification or add additional context in comments.

1 Comment

No worries — this is a very common Windows issue when Python gets re-installed or the file associations get changed. What you're seeing (the Python window flashing briefly) means: Windows is launching the script by double-click–style execution instead of running it in the CMD window.

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.