Thanks Bryan for the super-quick response!
However, the longer traceback only lists code from bokeh and json, and does not, as far as I can tell,
indicate what part of my document is causing the error. Is there a way to do that?
Thanks
JT
townes:luvoir_simtools tumlinson$ bokeh serve --show multiplanet_vis --log-level debug
2018-09-10 21:37:29,406 Starting Bokeh server version 0.12.16 (running on Tornado 5.0.2)
2018-09-10 21:37:29,407 These host origins can connect to the websocket: [‘localhost:5006’]
2018-09-10 21:37:29,408 Patterns are:
2018-09-10 21:37:29,408 [(‘/multiplanet_vis/?’,
2018-09-10 21:37:29,409 <class ‘bokeh.server.views.doc_handler.DocHandler’>,
2018-09-10 21:37:29,409 {‘application_context’: <bokeh.server.application_context.ApplicationContext object at 0x10a7ca630>,
2018-09-10 21:37:29,409 ‘bokeh_websocket_path’: ‘/multiplanet_vis/ws’}),
2018-09-10 21:37:29,409 (‘/multiplanet_vis/ws’,
2018-09-10 21:37:29,409 <class ‘bokeh.server.views.ws.WSHandler’>,
2018-09-10 21:37:29,409 {‘application_context’: <bokeh.server.application_context.ApplicationContext object at 0x10a7ca630>,
2018-09-10 21:37:29,409 ‘bokeh_websocket_path’: ‘/multiplanet_vis/ws’}),
2018-09-10 21:37:29,409 (‘/multiplanet_vis/metadata’,
2018-09-10 21:37:29,409 <class ‘bokeh.server.views.metadata_handler.MetadataHandler’>,
2018-09-10 21:37:29,409 {‘application_context’: <bokeh.server.application_context.ApplicationContext object at 0x10a7ca630>,
2018-09-10 21:37:29,409 ‘bokeh_websocket_path’: ‘/multiplanet_vis/ws’}),
2018-09-10 21:37:29,409 (‘/multiplanet_vis/autoload.js’,
2018-09-10 21:37:29,409 <class ‘bokeh.server.views.autoload_js_handler.AutoloadJsHandler’>,
2018-09-10 21:37:29,409 {‘application_context’: <bokeh.server.application_context.ApplicationContext object at 0x10a7ca630>,
2018-09-10 21:37:29,409 ‘bokeh_websocket_path’: ‘/multiplanet_vis/ws’}),
2018-09-10 21:37:29,409 (‘/?’,
2018-09-10 21:37:29,409 <class ‘bokeh.server.views.root_handler.RootHandler’>,
2018-09-10 21:37:29,409 {‘applications’: {‘/multiplanet_vis’: <bokeh.server.application_context.ApplicationContext object at 0x10a7ca630>},
2018-09-10 21:37:29,409 ‘prefix’: ‘’,
2018-09-10 21:37:29,410 ‘use_redirect’: True}),
2018-09-10 21:37:29,410 (‘/static/(.*)’,
2018-09-10 21:37:29,410 <class ‘bokeh.server.views.static_handler.StaticHandler’>)]
2018-09-10 21:37:29,411 Using selector: KqueueSelector
2018-09-10 21:37:29,412 Bokeh app running at: http://localhost:5006/multiplanet_vis
2018-09-10 21:37:29,412 Starting Bokeh server with process id: 23227
[0.20846054 0.48168106 0.42053804 … 0.50991985 0.3710494 0.1177326 ]
2018-09-10 21:37:30,221 200 GET /multiplanet_vis (::1) 677.21ms
2018-09-10 21:37:30,293 101 GET /multiplanet_vis/ws?bokeh-protocol-version=1.0&bokeh-session-id=86EAjD4uMSlykkdptSpoE8JVwdv7lyJHTFFgcDhOWP1w (::1) 0.76ms
2018-09-10 21:37:30,293 WebSocket connection opened
2018-09-10 21:37:30,293 Receiver created for Protocol(‘1.0’)
2018-09-10 21:37:30,294 ProtocolHandler created for Protocol(‘1.0’)
2018-09-10 21:37:30,294 ServerConnection created
2018-09-10 21:37:30,297 Sending pull-doc-reply from session ‘86EAjD4uMSlykkdptSpoE8JVwdv7lyJHTFFgcDhOWP1w’
2018-09-10 21:37:30,321 error handling message Message ‘PULL-DOC-REQ’ (revision 1): TypeError(“Object of type ‘bytes’ is not JSON serializable”,)
2018-09-10 21:37:30,321 message header {‘msgid’: ‘E86B8E2911F649939B01163EF4657C55’, ‘msgtype’: ‘PULL-DOC-REQ’} content {}
Traceback (most recent call last):
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/server/protocol_handler.py”, line 70, in handle
work = yield handler(message, connection)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/tornado/gen.py”, line 1099, in run
value = future.result()
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/tornado/gen.py”, line 1113, in run
yielded = self.gen.send(value)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/server/session.py”, line 51, in _needs_document_lock_wrapper
result = yield yield_for_all_futures(func(self, *args, **kwargs))
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/server/session.py”, line 194, in _handle_pull
return connection.protocol.create('PULL-DOC-REPLY', message.header['msgid'], self.document)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/protocol/init.py”, line 46, in create
return self._messages[msgtype].create(*args, **kwargs)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/protocol/messages/pull_doc_reply.py”, line 48, in create
content = { 'doc' : document.to_json() }
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/document/document.py”, line 781, in to_json
doc_json = self.to_json_string()
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/document/document.py”, line 810, in to_json_string
return serialize_json(json, indent=indent)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/core/json_encoder.py”, line 213, in serialize_json
return json.dumps(obj, cls=BokehJSONEncoder, allow_nan=False, indent=indent, separators=separators, sort_keys=True, **kwargs)
File “/Users/tumlinson/anaconda3/lib/python3.6/json/init.py”, line 238, in dumps
**kw).encode(obj)
File “/Users/tumlinson/anaconda3/lib/python3.6/json/encoder.py”, line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File “/Users/tumlinson/anaconda3/lib/python3.6/json/encoder.py”, line 257, in iterencode
return _iterencode(o, 0)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/core/json_encoder.py”, line 135, in default
return self.transform_python_types(obj)
File “/Users/tumlinson/anaconda3/lib/python3.6/site-packages/bokeh/core/json_encoder.py”, line 102, in transform_python_types
return super(BokehJSONEncoder, self).default(obj)
File “/Users/tumlinson/anaconda3/lib/python3.6/json/encoder.py”, line 180, in default
o.__class__.__name__)
TypeError: Object of type ‘bytes’ is not JSON serializable
···
On Sep 10, 2018, at 9:37 PM, Bryan Van de ven [email protected] wrote:
Hi,
Set the --log-level to “debug”
Thanks,
Bryan
On Sep 10, 2018, at 18:26, Jason Tumlinson [email protected] wrote:
Hi,
I have recently been converting bokeh apps over to python 3, which as we all know
has a distinction between bytes and strings. I have received an TypeError
“Object of type ‘bytes’ is not JSON serializable” for the first time. As it stands I have no
way to know what part of my code is at fault, since the message provides no
traceback. Is there a way to diagnose or correct this without inspecting every variable
one-by-one? Can I ask bokeh server to generate more thorough diagnostics? Is there
any other solution people aware of?
Thanks
JT
2018-09-10 21:14:53,168 Starting Bokeh server version 0.12.16 (running on Tornado 5.0.2)
2018-09-10 21:14:53,171 Bokeh app running at: http://localhost:5006/multiplanet_vis
2018-09-10 21:14:53,171 Starting Bokeh server with process id: 22957
[0.20846054 0.48168106 0.42053804 … 0.50991985 0.3710494 0.1177326 ]
2018-09-10 21:14:54,329 200 GET /multiplanet_vis (::1) 665.28ms
2018-09-10 21:14:54,510 101 GET /multiplanet_vis/ws?bokeh-protocol-version=1.0&bokeh-session-id=hC6lzkqEI26eyZ9IEFkz54n2DxwlSJrPRqqa8KA5jq6s (::1) 0.65ms
2018-09-10 21:14:54,510 WebSocket connection opened
2018-09-10 21:14:54,511 ServerConnection created
2018-09-10 21:14:54,539 error handling message Message ‘PULL-DOC-REQ’ (revision 1): TypeError(“Object of type ‘bytes’ is not JSON serializable”,)
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/DE26AFC7-3DCB-49EC-85C1-8B85A02E1E38%40gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/534A74AB-FF27-4F82-A186-A9808E5279EF%40anaconda.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.