title: Python: How to get the line in my Flask application which led to an error?
body: <p>I'm building a website using Flask. I now ran into an error which gives a traceback giving no clue as to which part of my own written code has led to the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1836, in __call__
      return self.wsgi_app(environ, start_response)
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1820, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1403, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1817, in wsgi_app
      response = self.full_dispatch_request()
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1478, in full_dispatch_request
      response = self.make_response(rv)
    File "/Library/Python/2.7/site-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1577, in make_response
      rv = self.response_class.force_type(rv, request.environ)
    File "/Library/Python/2.7/site-packages/Werkzeug-0.9.4-py2.7.egg/werkzeug/wrappers.py", line 824, in force_type
      response = BaseResponse(*_run_wsgi_app(response, environ))
    File "/Library/Python/2.7/site-packages/Werkzeug-0.9.4-py2.7.egg/werkzeug/wrappers.py", line 57, in _run_wsgi_app
      return _run_wsgi_app(*args)
    File "/Library/Python/2.7/site-packages/Werkzeug-0.9.4-py2.7.egg/werkzeug/test.py", line 854, in run_wsgi_app
      app_iter = app(environ, start_response)
  TypeError: 'numpy.float64' object is not callable
  </code></pre>
  
  <p>I'm indeed using numpy here and there in my code, but seeing this stacktrace, I have no idea where I need to start looking for the error in my own code.</p>
  
  <p>[EDIT]
  Thanks for the comments. I found my error; I was indeed returning a numpy float.</p>
  
  <p>It doesn't solve the underlying problem I sometimes have with Flask though; where can I find the line in my code that caused the error? Why doesn't the stacktrace include the line in my own scripts for convenience. Is there a way that I can always return the line in my own scripts that caused the error? Of course we're all technical people here, but I think this is a very, very, (VERY!) important feature for newbies to Flask..</p>
  
  <p>So I changed the title of my question back to how it was, because that is actually the underlying question here.</p>
  
  <p>Any tips would be welcome!</p>