I have a script that I need to restart every hour due to memory usage issues - I was not able to detect memory leaks unfortunately.
I have been using the following that works well:
os.execv(sys.executable, ['python'] + [sys.argv[0]])
However, every time it throws a syntax error when the code restarts (even though the code has been running fine for the previous hour). For instance the latest was on this line, which is syntactically correct:
value = f'{int(value):,}'
The code is running on Termius.
Has this occurred to anyone before? Is it related to the compiler?
question from:
https://stackoverflow.com/questions/65858847/syntax-error-after-restarting-script-from-within-itself 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…