I have the following very simplified situation

from atexit import register


def goodbye():
    print("saying goodbye")


def main():
    while True:
        var = raw_input("read something")


if __name__ == '__main__':
    register(goodbye)
    main()


But in my case the "goodbye" function is deleting the logging file which was created
during the application execution.
Now the problem is that it *always* executes, even when the applications quits for
some bad errors.

Is there a way to have an exit hook, which doesn't execute in case of errors? I've seen the code of atexit and it apparently doesn't know anything about the current
status and why the application is actually quitting, is that correct?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to