@app.route('/diskio', methods=['POST','GET'])
def disk_io():
if request.method == 'GET':
data = diskIO.get_io()
print data
return data #data这里是一个list
elif request.method == 'POST':
pass
image.png
TypeError
TypeError: 'list' object is not callable
Traceback (most recent call last)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1615, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1630, in finalize_request
response = self.make_response(rv)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1740, in make_response
rv = self.response_class.force_type(rv, request.environ)
File "/usr/lib/python2.7/site-packages/werkzeug/wrappers.py", line 921, in force_type
response = BaseResponse(*_run_wsgi_app(response, environ))
File "/usr/lib/python2.7/site-packages/werkzeug/wrappers.py", line 59, in _run_wsgi_app
return _run_wsgi_app(*args)
File "/usr/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app
app_rv = app(environ, start_response)
TypeError: 'list' object is not callable
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
#返回json
@app.route('/diskio', methods=['POST','GET'])
def disk_io():
if request.method == 'GET':
data = diskIO.get_io()
print data
return json.dumps(data) #返回json
elif request.method == 'POST':
pass
正常数据出来了:
image.png