holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.73k stars 516 forks source link

Preview with Panel broken with notifications turned on #7380

Open MP-MaximilianLattka opened 1 week ago

MP-MaximilianLattka commented 1 week ago

ALL software version info

Software Version Info ```plaintext Python 3.12.7 Panel 1.5.2 (still working on 1.4.5) ```

Description of expected behavior and the observed behavior

Using the "Preview Notebook with Panel"/"Open with Panel in New Browser Tab" feature in combination with pn.extension(notifications=True) is working with older panel versions such as 1.4.5, but results in an "Kernal error" using more recent versions, such as 1.5.2.

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
pn.extension(notifications=True)
template = pn.template.BootstrapTemplate()
template.servable();

Stack traceback and/or browser JavaScript console output

Traceback (most recent call last):
  File "/home/USER/workspace/test/panel_bug/panel_bug.ipynb", line 22, in <module>
    }
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/pyviz_comms/__init__.py", line 64, in __new__
    return param.ParameterizedFunction.__new__(cls, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/param/parameterized.py", line 4468, in __new__
    return inst.__call__(*args,**params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/config.py", line 849, in __call__
    load_notebook(
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/io/notebook.py", line 409, in load_notebook
    bundle = bundle_resources(
             ^^^^^^^^^^^^^^^^^
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/io/resources.py", line 409, in bundle_resources
    css_files.extend(css_resources.css_files)
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/io/resources.py", line 715, in css_files
    self.extra_resources(files, '__css__')
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/io/resources.py", line 645, in extra_resources
    resource = component_resource_path(model, resource_type, resource)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/USER/workspace/test/panel_bug/.venv/lib/python3.12/site-packages/panel/io/resources.py", line 261, in component_resource_path
    rel_path = os.fspath(resolve_custom_path(component, path, relative=True)).replace(os.path.sep, '/')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType
MP-MaximilianLattka commented 1 week ago

Latest working Panel version: 1.4.5

Earliest non-working Panel version: 1.5.0