I have problem view JSON data. View does not work.
500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "C:\Python3\lib\site-packages\cherrypy\_cprequest.py", line 675, in respond
response.finalize()
File "C:\Python3\lib\site-packages\cherrypy\_cprequest.py", line 947, in finalize
content = self.collapse_body()
File "C:\Python3\lib\site-packages\cherrypy\_cprequest.py", line 911, in collapse_body
repr(chunk))
TypeError: Chunk {'__type__': 'Anchor', 'code': 'AN2', 'fwver': '0.8', 'host': '10.10.10.105', 'hwver': '0.10', 'idanchor': '2b590a73-e7af-47a1-bee5-dc8dd854e86a', 'locgeog': '0101000020E6100000A541A070CA092D40C055CEC46F074940', 'name': 'V rohu vpravo od dveří', 'port': 12344, 'rtlsaddress': 'DECA013010000BD6'} is not of type 'bytes'
I think that CherryPy is not been very friendly with that error, but basically the handler is expected to return bytes
not a dictionary. For that you need to decorate the method with @cherrypy.tools.json_out()
.
For more information: http://docs.cherrypy.org/en/latest/basics.html?highlight=json#encoding-response