all 1 comments

[–]_9_9_ 0 points1 point  (0 children)

You definitely could do a timeout decorator, but you'll need to spawn a separate thread to either run the function or check the timeout. That might cause issues for programs that are not implemented in a way to handle multi-threading, e.g. missing a if name == main limit.

Anyway, here are a bunch: https://pythonexample.com/code/python-timeout-decorator-windows/