-2

Good afternoon,

I have a py script that I need to automate via a batch file. Now, the batch I have created is as follows python"C:\Users\ShaneN\Anaconda3\python.exe" "C:\Users\ShaneN\Desktop\PYGAM.py" but when I attempt to run it, the cmd screen flashes and closes before I can see what's happening. Also to note that it does not run the script. Any suggestions?

  • 1
    https://stackoverflow.com/questions/12375173/how-to-stop-python-closing-immediately-when-executed-in-microsoft-windows This might answer your question – Jelle Westra Jul 07 '21 at 18:00

3 Answers3

0

run script in compiler of python because I think there is error in your code that causes cmd to close bec no return value or user input to make cmd. freeze

Rooted0x01
  • 31
  • 4
0

The batch script closes once it's done. Once a script has no more code to run, the window closes. If you want to keep the window open, you can use the pause command.

You can try to run the script in command prompt and use echo and pause to help with debugging.

NcXNaV
  • 1,657
  • 4
  • 14
  • 23
0

It is probably because of some error in the code. Try adding

input('Press enter to exit ')

on the last line

Soham Ghosh
  • 169
  • 2
  • 3