Closed jordansamuels closed 1 month ago
Hi @jordansamuels
Thanks for the well described bug report. You could try to make the PR by just changing sys.path = [os.getcwd()] + sys.path[1:]
to sys.path = [os.getcwd()] + sys.path
.
As there is no test or documentation of the change in 4489, then Philipp would be the only one knowing why it was [1:]
anyways and he would be able to quickly pick up and adjust your PR if needed.
[...] You could try to make the PR by just changing
sys.path = [os.getcwd()] + sys.path[1:]
tosys.path = [os.getcwd()] + sys.path
.
Thanks! I made PR #7059 for this. This is my first PR for this repo, so please let me know if I can adjust anything.
This bug appears related to the change in #4489 . That change uses
sys.path[1:]
, but this means that the first element of the path is omitted. This causes import issues in panel preview when importing a file from the first element of the PYTHONPATH. Moreover, if I locally change tosys.path
instead ofsys.path[1:]
inpanel/io/jupyter_server_extension.py
then it fixes the issue.ALL software version info
panel=1.4.4=pyhd8ed1ab_0
python=3.11.9=h932a869_0_cpython
jupyterlab=4.2.3=pyhd8ed1ab_0
Tested on OSX and Linux. Full software versions in repro here.
Description of expected behavior and the observed behavior
Full repro instructions at https://github.com/jordansamuels/panel-jupyter-path-bug-repro.
Expected: panel preview works in jupyter lab. Observed: import exception.
Complete, minimal, self-contained example code that reproduces the issue
Full repro at https://github.com/jordansamuels/panel-jupyter-path-bug-repro.
Stack traceback and/or browser JavaScript console output
(none relevant that I could find)
Screenshots or screencasts of the bug in action