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.
2
Answers
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.
Please start VS Code in a project (workspace) folder.