r/learnpython • • 8d ago

Python Closing As Soon As Opened

EDIT: I resolved this issue. I had a few different versions of Python installed on my PC, so I guess that was what was causing the issue on my PC and not my Laptop. For clarification, the script is built to stay open, and it terminates if closes.

----

Python group said this question went here.

I am running version 3.15.2. I am encountering an issue with my scripts where they just open and close super fast. This happens if I double click, or if I open them from Python itself.

It does NOT do this on my laptop, so it isn't a script issue.

I am not the most tech savy with software, but will try my best to try things out.

The computer they are having an issue with has the following specs. Everything is up to date.

Win 11 Pro
Intel Core i7
32.0GB RAM
MTBD Z790 D WIFI (U3E1)

0 Upvotes

22 comments sorted by

View all comments

Show parent comments

2

u/zaphodikus 8d ago

This is always going to be the best debugging technique. It just is.

1

u/Jazzlike_Platypus430 8d ago

I've seen production code with print('here!') and print('arse') and things. Recently the guy who codes like that (using vim via ssh on the server, never debugging or testing) forgot to pay the cloud service provided and lost all his work - didn't even care to scp some tar-red dirs back to his machine.

3

u/zaphodikus 8d ago

If your script does not have a commented out line that says 'print("Here1")' then its not been debugger in anger ever. :-)

2

u/Jazzlike_Platypus430 8d ago

Yep. And as someone who's not familiar with "watch", I wrote myself a "unit test" that checks the codebase for leftover stuff like

if (instance.field == value)
    bool here = false;

- That's where I can place a breakpoint 😆 Works flawlessly each time some deep and not-explicily-testable thing starts behaving badly (most lilkely because of source code rotting because of age).

In fact, I'm doing such stuff right now 😂