I have a massive Python script that needs to be restarted automatically when it breaks. When I try a standard approach by wrapping the script into a function and then calling it via while True
, I get this error:
SyntaxError: unqualified exec is not allowed in function 'wrappedFunc' because it contains a nested function with free variables
As I understand, this is due to the fact that my main script has sub functions. Can I still do it somehow via Python or should this be done in Windows via a batch file?