Am 31.12.2020 um 18:06 schrieb Mats Wichmann:
What you're doing is going to give you probably unexpected results
anyway. Here's why:  (when it's set up properly) when clicking from explorer Windows will create a window to run the Python interpreter in, and when your script finishes, Python quits. Windows will take that as a clue that the window is no longer needed, and it will be discarded. This will usually have the visual effect of a window flashing onto the screen and then vanishing, as if things were broken, but they're not.  Only a Python script that is written to manage a display window, is going to stay around. An old is to add an input() call at the end of your script, so it waits for you to hit the enter key before finishing, and that will leave the window open)

But that doesn't help, if the script raises an exception. In that case the input() call won't be reached and the window will close anyway before you could see anything. And in a script with errors that's even worse. Same effect with the "run" window.

Either run your scripts from a command shell...

It's really bad that Windows doesn't put links to the command shell on the desktop and into the task bar on installation.

Or use an editor or IDE that has an integrated way to run your programs there in the editor's environment - here the IDE manages the windows so you don't get the opens-then-closes effect.

Hope this helps.



--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to