atexit

What are the implications of registering an instance method with atexit in Python?

What are the implications of registering an instance method with atexit in Python? Question: Assume I’ve got some really big Python class that might consume a fair amount of memory. The class has some method that is responsible for cleaning up some things when the interpreter exits, and it gets registered with the atexit module: …

Total answers: 2

Flask and Web.py both hang on atexit

Flask and Web.py both hang on atexit Question: I have this simple Flask app: from flask import Flask import prolog_handler as p app = Flask(__name__) app.debug = False @app.route(‘/’) def hello(): for rule in p.rules: print rule return ‘hello’ if __name__ == ‘__main__’: app.run(host=’0.0.0.0′, port=8080) The prolog_handler module starts a session with a triplestore and …

Total answers: 1

How to find exit code or reason when atexit callback is called in Python?

How to find exit code or reason when atexit callback is called in Python? Question: I want to know if a Python script is terminating correctly or not. For this I am using atexit but the problem is that I do not know how to differentiate if atexit was called with sys.exit(0) or non zero …

Total answers: 2