You are viewing a single comment's thread from:

RE: Python Function Attributes to Handle Interupt

in #python7 years ago (edited)

Here is my deleted comment, in case it will help someone in the future.

While I do not have much experience in Python. I read about the atexit module on stackoverflow.com and I thought it looks interesting.

https://docs.python.org/3/library/atexit.html

However, I see there are some multi-process uses cases that are not interrupt friendly, and it may not work for your case. I wonder if you can modify the solution below for backup rather than delete?

https://stackoverflow.com/questions/9916301/error-with-multiprocessing-atexit-and-global-data

I hope someone with more experience will chime in. Keep us posted, and good-luck. --3D

Sort:  

Based on the case scenario, since my exit scenario is simply writing to a document it should work on exit scenarios as the multiprocess error you brought up did have a potential fix for case specific scenarios.

I wish I had a larger upvote to offer you for this. To make up for it I am offering you a cut of the profits upon payout.

I am happy it is working out. That is very kind of you. Thanks!