0

I have recently deleted python 3.8.1 and decided to keep using python 3.7.4

However, I am speculating that the python launcher keeps crashing because it is using the deleted python version. When I try to open the file with python 3.7.4 by right clicking then going to the python idle and running the file using it, it doesn't crash. But, when I double click the file to run it, the python launcher crashes.

How can I fix that problem ?

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
saiffarid
  • 43
  • 1
  • 2
  • 9
  • what kind of OS are you using? – devaerial Feb 26 '20 at 14:28
  • I am using windows 10 – saiffarid Feb 26 '20 at 14:29
  • Kindly figure out what your path is. I am a mac/ubuntu user so for me I would do `echo $PATH` If you are a developer, you should definitely get a terminal for windows. [something like this](https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/) – DUDANF Feb 26 '20 at 14:34
  • 1
    Have you checked system paths? As it was suggested in [this](https://stackoverflow.com/questions/3515673/how-to-completely-remove-python-from-a-windows-machine) thread your system path might be configured to use old version (3.8.1). – devaerial Feb 26 '20 at 14:34

1 Answers1

1

After installing python and the py.exe launcher with the installer from python.org, double clicking a .py file should run the file with py.exe, which will run the file with python.exe in a new console window. If there is more than one python.exe (say 3.7.u and 3.8.v), py.exe selects the last one with 'make this default' checked during installation. Or it selects the most recent version. One can determine the current default by running 'py' at a Command Prompt command line and checking the first line of the interactive message.

When python finishes executing the file, it exits and the new window closes. For a typical beginner file, this takes less than a second, especially if there is an error and traceback on startup. In any case, one likely will never see any output. I suspect that this is what you are calling a 'crash'. If so, everything is working as designed.

To prevent the window from closing, prevent python from existing by adding a blocking function call such as input('Hit return to exit: ') at or near the end. For a tkinter program, root.mainloop() blocks until the tkinter window is closed.

To see what the program outputs without editing it, run it in Command Prompt. py path-to-something.py.

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52