holoviz/lumen

Enabling `sync_with_url` for Altair Seattle Weather raises an error when setting the date

hoxbro opened this issue · 1 comments

hoxbro commented

Enabling sync_with_url for Altair Seattle Weather raises an error when setting the date

Update the config to the following:

config:
  title: Altair Seattle Weather
  reloadable: false
  sync_with_url: true

And comment out margin because of #454

2023-03-27 12:43:22,884 ERROR: panel.reactive - Callback failed for object named "Date" changing property {'value': (datetime.datetime(2015, 12, 9, 0, 0),
           datetime.datetime(2015, 12, 24, 0, 0))} 
Traceback (most recent call last):
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 378, in _process_events
    self.param.update(**self_events)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1902, in update
    self_._batch_call_watchers()
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2063, in _batch_call_watchers
    self_._execute_watcher(watcher, events)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 742, in reverse_link
    setattr(self, reverse_links[event.name], event.new)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 367, in _f
    instance_param.__set__(obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1252, in __set__
    obj.param._call_watcher(watcher, event)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2043, in _call_watcher
    self_._execute_watcher(watcher, (event,))
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 727, in link_cb
    setattr(target, links[event.name], event.new)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 367, in _f
    instance_param.__set__(obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1252, in __set__
    obj.param._call_watcher(watcher, event)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2043, in _call_watcher
    self_._execute_watcher(watcher, (event,))
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/io/location.py", line 144, in _update_query
    val = json.dumps(val)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable
2023-03-27 12:43:22,894 Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7fc104edac20>>, <Task finished name='Task-314' coro=<ServerSession.with_document_locked() done, defined at /home/shh/miniconda3/envs/holoviz/lib/python3.10/site-packages/bokeh/server/session.py:77> exception=TypeError('Object of type datetime is not JSON serializable')>)
Traceback (most recent call last):
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/site-packages/tornado/ioloop.py", line 741, in _run_callback
    ret = callback()
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/site-packages/tornado/ioloop.py", line 765, in _discard_future_result
    future.result()
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/site-packages/bokeh/server/session.py", line 98, in _needs_document_lock_wrapper
    result = await result
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 423, in _change_coroutine
    state._handle_exception(e)
  File "/home/shh/Repos/holoviz/panel/panel/io/state.py", line 412, in _handle_exception
    raise exception
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 421, in _change_coroutine
    self._change_event(doc)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 439, in _change_event
    self._process_events(events)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 378, in _process_events
    self.param.update(**self_events)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1902, in update
    self_._batch_call_watchers()
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2063, in _batch_call_watchers
    self_._execute_watcher(watcher, events)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 742, in reverse_link
    setattr(self, reverse_links[event.name], event.new)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 367, in _f
    instance_param.__set__(obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1252, in __set__
    obj.param._call_watcher(watcher, event)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2043, in _call_watcher
    self_._execute_watcher(watcher, (event,))
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/reactive.py", line 727, in link_cb
    setattr(target, links[event.name], event.new)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 367, in _f
    instance_param.__set__(obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 1252, in __set__
    obj.param._call_watcher(watcher, event)
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2043, in _call_watcher
    self_._execute_watcher(watcher, (event,))
  File "/home/shh/Repos/holoviz/param/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/home/shh/Repos/holoviz/panel/panel/io/location.py", line 144, in _update_query
    val = json.dumps(val)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable