I am trying to install a REST web service using Flask. I had a problem with error handling @app.errorhandler(404)
#!flask/bin/python from flask import Flask, jsonify, abort app = Flask(__name__) @app.errorhandler(404) def not_found(error): return jsonify({'error':'not found'}), 404 if __name__ == '__main__': app.run(debug = True)
When I do this, I get nothing. In my debugger, this tells me that I have a TypeError: 'Response' object is not iterable
I used jsonify in another method with a dictionary without problems, but when I return it as an error, it does not work. Any ideas?
Chris source share