Reputation: 173
Is there any method to set certain action when my python program ends abruptly? Especially I want to delete a folder and leave a log what was the error using logging module.
Upvotes: 0
Views: 31
Reputation: 513
You can use error handling, particuarly using the Try, Except statements.
Upvotes: 0
Reputation: 33345
Depending on what you mean by "ends abruptly", the atexit
module https://docs.python.org/2/library/atexit.html may be what you are looking for.
Upvotes: 1