I’m a beginning programmer in Python and I have a strange problem with my computer. When I have a .py file on my computer (containing a script that works), and I double click on it to open, the following happens: the program opens (it’s the black screen view), but it shuts itself down within a second, and the program isn’t executed. However, when I right click and choose “edit with IDLE”, everything works as normal.
I didn’t have this problem from the beginning on, but then I installed some other versions of Python and I think that’s the moment when scripts didn’t want to open anymore.
What is happening is that there has been an association with the
pyextension and it probably is running your program, but it is closing too quickly for you to see any output. You can add a wait or just open a command prompt and run everything from there.Another solution, and in my opinion the more ideal one, is to set the association of the
pyextension to IDLE. This would solve your issue as the file will open by default in IDLE and from there you can run the Python script.Changing File Associations In Windows 7