Short answer: If absence of input()
in the end of the file is not the case, then double-tripple-quadripple check what version of Python is trying to run your script when double-clicked from explorer. To do so put import pdb; pdb.set_trace()
somewhere up in the script, double-click it, and look at the header of the window.
The question is in the header. I've written a simple python app which works well if i run it from Iddle and if i run it from command line by "python foo.py" (using Windows 10).
However it doesn't work if run by double-clicking in win. explorer. Command line window pops up, flashes - and it's gone. I managed to conclude that commenting out these imports:
from pysvn import Client
from urllib import parse
prevents whatever bad happens from happening, and app can run, but i need those imports.
What could possibly cause this? I am sure that file assosiation is set correctly and double clicking causes C:\Python\Python 3.5.3\python.exe to open .py files. What's the difference between running .py from command line and running them from win. explorer?
Edit 1: i did try to create a bat file with this line in it: "C:\Python\Python 3.5.3\python.exe" foo.py %*
- and it works just fine. However, a shortcut to cmd.exe made as said here doesn't work.
Edit 2: @Mark Mikofski comment helped me to notice that even though i thought double-clicking causes C:\Python\Python 3.5.3\python.exe to open .py files - process name showed it was python2.7. Even when i right-click my foo.py file and manually open it with python.exe from Python 3.5 folder. This is a mystery for me, but uninstalling python 2.7 helped to solve the issue, so now i know i should search on how to make different versions of python run together smoothly and/or how to tell a script to use a specific version (shebang doesn't seem to work on windows)