Panel Preview in jupyter not able to find file with relative path

Hi,

I am facing an issue with the preview button in jupyterlab for panel. It does not seem to be able to find file loaded from a relative path.

For example, Consider the following file structure:

root -> lab is launched from root
|__some_folder
     |__notebook.ipynb
     |__data.csv

Now if I have a code in my notebook like

df = pd.read_csv('data.csv')

The panel preview button is not able to find the file. Is there a workaround for this?

1 Like

Can you try pd.read_csv('some_folder/data.csv').

It might work for the preview but in lab it will fail right?

So my general development is like develop parts of the application in different cells and then see the final preview in panel preview with a template.

But the above solution would work only in panel preview and not in lab IMO

1 Like

You can do a try/ except in the notebook cell to try both. But please file this as a bug on Github. Thanks.

Yep that’s the workaround I am using now. Thanks Marc, will log an issue as well.

1 Like