How to make the program stop? sys.exit() not working.

AAAAAAAAAA
AAAAAAAAAA edited November 12 in Python client
I use spyder IDE and my program is unable to stop after the set hours. Its not causing any harm, but since spyder shows the values of the variables after a program stops, it helps in debugging. So far I have only been able to debug because I log everything. But this approach has its limits.

Now it does exit using sys.exit() BEFORE it hits kws.connect(). As soon as it hits, sys.exit() is essentially ineffective and the error is "builtins.SystemExit: ".
I know it says in the documentation that kws.connect() is basically like an infinite loop, but there must be a way to exit the program.

I do use we.close() to close the connection, that part is ok. But as you know it does not exit the program.
Tagged:
  • AAAAAAAAAA
    AAAAAAAAAA edited November 12
    I think I solved it. Basically had to import _thread then used _thread.interrupt_main() when i wanted the program to end and added kws.connect() to a try-except block for a neat exit -- is this ok?

This discussion has been closed.