Home > Back-end >  Python Files running in the terminal however not running when i run the actual file after importing
Python Files running in the terminal however not running when i run the actual file after importing

Time:08-29

my python files are running in the terminal, however when i actually run the .py file in file explorer they dont run, they only dont run after importing a non already installed python library, for example colorama.

Im really new to programming so any help appreciated.

CodePudding user response:

My guess is that the python executable you associated with the .py filetype in your operating system is not executable you expect. This could happen, for instance, if you have both plain python and conda python on the same system.

The following is more of a suggestion than an answer, but it's too long to put in a comment:

First, try putting input('Press enter to continue...') at the end of your file, so the window won't close immediately on error.

Next, run the code import sys; print(sys.executable); print(sys.path); input('Press enter to continue...')

The output of the above code will tell you the exact location of your python executable as well as what folders your program draws your libraries from.

CodePudding user response:

Please start VS Code in a enter image description here

  • Related