Skip to content

fix: pass the absolute assets folder to the show_dash app - #371

Open
raashish1601 wants to merge 1 commit into
predict-idlab:mainfrom
raashish1601:fix/362-show-dash-assets-path
Open

raashish1601 wants to merge 1 commit into
predict-idlab:mainfrom
raashish1601:fix/362-show-dash-assets-path

Conversation

@raashish1601

Copy link
Copy Markdown

Fixes #362

show_dash() set assets_folder to os.path.relpath(ASSETS_FOLDER, os.getcwd()) when the overview is enabled. On Windows, relpath raises ValueError: path is on mount 'C:', start on mount 'E:' when the working directory is on a different drive than plotly-resampler, so show_dash() fails.

Dash builds the final path with os.path.join(get_root_path("local_app"), assets_folder), and an absolute path passes through that join unchanged. So this passes ASSETS_FOLDER as is, which is already absolute. The os import is no longer used and is removed.

Test: test_show_dash_assets_folder_outside_cwd changes to a temp directory, runs show_dash with the overview, and checks that the app's assets_folder is ASSETS_FOLDER and that /assets/coarse_fine.js is served. On main, the configured folder is a long ..\..\ path relative to the temp dir. I only have one drive here, so I checked the cross-drive error itself with ntpath.relpath directly.

The show_dash tests and the rest of tests/test_figure_resampler.py pass locally (non-selenium), apart from test_multiple_timezones_in_single_x_index__datetimes_and_timestamps and the two test_fr_update_layout_axes_range* tests, which fail the same way on main in my environment. ruff check and black --check are clean. I added a changelog line under "Latest".

…lab#362)

show_dash passed the assets folder relative to the cwd. On Windows,
os.path.relpath raises a ValueError when the cwd is on another drive
than plotly-resampler. Dash joins assets_folder with the app root, so
an absolute path works everywhere.

Fixes predict-idlab#362

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant