Debugging Threading Termination Error

I have a series of threads running that I am trying to stop. I believe I have worked out stopping them all but when my main script exits I get this error.

Tcl_AsyncDelete: async handler deleted by the wrong thread
Aborted

The last command in the script is 'print(threading.enumerate())" which displays:

[<_MainThread(MainThread, started 1996111552)>]

So if the main thread is all that is left and it exits, what does that error mean and how do I debug it? TIA.

Non-trivial problem to debug. I found that it was not threading but rather tkinter that was the problem. The hint was ‘Tcl’ in the error message. I exited ‘mainloop’ using ‘destroy’ rather than ‘quit’. All good now.

1 Like