Forums

TypeError: 'numpy.ndarray' object is not callable

Hi there, My application has suddenly started to throw this error? It is a Python 3.4 application hosted in Flask 3.4

The error is thrown by one of the packages in "dist-packages", to which I do not have access to check. Has anyone seen this error earlier? Below is the stack trace. Any guidance will be helpful.

2016-03-03 03:36:29,941 :Exception on /PredictTicketDeptt/ [POST] Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1478, in full_dispatch_request response = self.make_response(rv) File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1577, in make_response rv = self.response_class.force_type(rv, request.environ) File "/usr/local/lib/python3.4/dist-packages/werkzeug/wrappers.py", line 827, in force_type response = BaseResponse(_run_wsgi_app(response, environ)) File "/usr/local/lib/python3.4/dist-packages/werkzeug/wrappers.py", line 57, in _run_wsgi_app return _run_wsgi_app(args) File "/usr/local/lib/python3.4/dist-packages/werkzeug/test.py", line 855, in run_wsgi_app app_iter = app(environ, start_response) TypeError: 'numpy.ndarray' object is not callable

I can see that I get this error when I try to use scikit learn (SVM) library. I have not explicitly installed this library in my installation? Do I need to or PythonAnywhere has a global package directory from where it can be resolved?

Also where is the "dist-packages" folder. I cannot see it, I guess this is PythonAnywhere's global package directory. I may be entirely wrong. Please correct me.

This is solved now

After some fiddling I found, it was the print function. print cannot handle numpy array.. you need to convert to str first.

Thanks for your attention.

glad you figured it out! :)