Hello, I’m trying to extend a bokeh class. Here’s some sample code:
class TestDiv(Div):
def __init__(self):
super(Div, self).__init__(text="")
__implementation__ = JavaScript("")
I can instantiate this all right:
TestDiv()
# returns TestDiv( id = '1002', …)
however, when i try to display it using bokeh.potting.show
, I get this error:
show(TestDiv())
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 show(TestDiv())
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/io/showing.py:144, in show(obj, browser, new, notebook_handle, notebook_url, **kwargs)
141 state = curstate()
143 if isinstance(obj, LayoutDOM):
--> 144 return _show_with_state(obj, state, browser, new, notebook_handle=notebook_handle)
146 def is_application(obj: Any) -> TypeGuard[Application]:
147 return getattr(obj, '_is_a_bokeh_application_class', False)
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/io/showing.py:195, in _show_with_state(obj, state, browser, new, notebook_handle)
192 shown = True
194 if state.file or not shown:
--> 195 _show_file_with_state(obj, state, new, controller)
197 return comms_handle
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/io/showing.py:176, in _show_file_with_state(obj, state, new, controller)
172 def _show_file_with_state(obj: LayoutDOM, state: State, new: BrowserTarget, controller: BrowserLike) -> None:
173 '''
174
175 '''
--> 176 filename = save(obj, state=state)
177 controller.open("file:// style="color:rgb(175,0,0)">" + filename, new=NEW_PARAM[new])
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/io/saving.py:98, in save(obj, filename, resources, title, template, state)
95 theme = state.document.theme
97 filename, resources, title = _get_save_args(state, filename, resources, title)
---> 98 _save_helper(obj, filename, resources, title, template, theme)
99 return abspath(filename)
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/io/saving.py:164, in _save_helper(obj, filename, resources, title, template, theme)
160 '''
161
162 '''
163 from ..embed import file_html
--> 164 html = file_html(obj, resources, title=title, template=template or FILE, theme=theme)
166 with open(filename, mode="w", encoding="utf-8") as f:
167 f.write(html)
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/embed/standalone.py:348, in file_html(models, resources, title, template, template_variables, theme, suppress_callback_warning, _always_new)
346 (docs_json, render_items) = standalone_docs_json_and_render_items(models_seq, suppress_callback_warning=suppress_callback_warning)
347 title = _title_from_models(models_seq, title)
--> 348 bundle = bundle_for_objs_and_resources([doc], resources)
349 return html_page_for_render_items(bundle, docs_json, render_items, title=title,
350 template=template, template_variables=template_variables)
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/embed/bundle.py:220, in bundle_for_objs_and_resources(objs, resources)
217 css_raw.extend(css_resources.css_raw)
219 if js_resources:
--> 220 extensions = _bundle_extensions(objs, js_resources)
221 mode = js_resources.mode if resources is not None else "inline"
222 if mode == "inline":
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/site-packages/bokeh/embed/bundle.py:298, in _bundle_extensions(objs, resources)
296 names.add(name)
297 module = __import__(name)
--> 298 this_file = abspath(module.__file__)
299 base_dir = dirname(this_file)
300 dist_dir = join(base_dir, "dist")
File ~/opt/anaconda3/envs/isxtools/lib/python3.8/posixpath.py:374, in abspath(path)
372 def abspath(path):
373 """Return an absolute path."""
--> 374 path = os.fspath(path)
375 if not isabs(path):
376 if isinstance(path, bytes):
TypeError: expected str, bytes or os.PathLike object, not NoneType
any help appreciated!