Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
102 views
in Technique[技术] by (71.8m points)

python - Syntax error after restarting script from within itself

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...