Skip to content

[BUG] FigureResampler.show_dash raises ValueError when running from other disk than C:Β #362

@balazsu

Description

@balazsu

Describe the bug πŸ–οΈ
When calling FigureResampler.show_dash, I get a ValueError originating from os.path.relpath when my cwd is on an other disk than the installation path of plotly-resampler. In my case C: and E:. On Windows there is no relative path between the 2.

---------------------------------------------------------------------------
File C:\programs\Python312\Lib\site-packages\plotly_resampler\figure_resampler\figure_resampler.py:570, in FigureResampler.show_dash(self, mode, config, init_dash_kwargs, graph_properties, **kwargs)
--> 570 init_dash_kwargs["assets_folder"] = os.path.relpath(ASSETS_FOLDER, os.getcwd())
    571 # Also include the lodash script, as the client-side callbacks uses this
    572 init_dash_kwargs["external_scripts"] = ["https://cdn.jsdelivr.net/npm/lodash/lodash.min.js" ]

File <frozen ntpath>:783, in relpath(path, start)

ValueError: path is on mount 'C:', start on mount 'E:'

Reproducing the bug πŸ”
0) Use Windows, this bug should not be a problem on a Linux/Unix based OS

  1. Check installation path of plotly-resampler
  2. Choose an other disk and execute from any directory on this disk an example code using FigureResampler.show_dash function

Expected behavior πŸ”§
You should face the same error as in the description.

Environment information: (please complete the following information)

  • OS: Windows 11 Pro 24H2
  • Python environment: Python 3.12.5
  • plotly-resampler environment: e.g.: Jupyterlab 4.2.5, Chrome
  • plotly-resampler version: 0.11.0

Possible fix:
Use full path for assets folder : Replace faulting line by :
init_dash_kwargs["assets_folder"] = ASSETS_FOLDER

Note that I am not familiar with plotly, nor plotly-resampler. I don't know if the usage of relative paths is required for some reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions