Skip to content

[BUG] pages_folder written with "/" on Windows gives wrong page module names and paths #4217

Description

@goranai

Describe your context

  • dash 4.5.2 (dev at 62d4681)
  • Windows 11, Python 3.14

Describe the bug

On Windows, a pages_folder written with forward slashes, such as pages_folder="src/pages", makes every page module name contain a / and keeps the folder in the inferred page path.

os.path.join(root, "src/pages") gives a mixed path, and _path_to_module_name only splits on os.sep (a backslash on Windows). The module name becomes src/pages.home. _infer_path then looks for the folder name pages as a whole dotted part, does not find it, and keeps the whole name.

Forward-slash folders are common in real apps:

Minimal app, files src/pages/home.py and src/pages/about_us.py (each has dash.register_page(__name__) and a layout):

import dash
from dash import Dash, html

app = Dash(__name__, use_pages=True, pages_folder="src/pages")
app.layout = html.Div(dash.page_container)
for k, v in dash.page_registry.items():
    print(repr(k), v["path"])

Expected behavior

Same as on Linux and as with pages_folder="src\pages":

'src.pages.about_us' /about-us
'src.pages.home' /home

Actual behavior (Windows)

'src/pages.about_us' /src/pages/about-us
'src/pages.home' /src/pages/home

The same app with pages_folder="src\pages" gives the expected output, so page URLs change with how the folder is written.

The repo's own tests show it too: on Windows, tests/unit/pages has 6 failures on dev, among them four test_path_to_module_name cases with / paths and test_import_layouts_from_pages[...sub_dir/custom_pages...].

Validated with Claude Opus 5.5.

Activity

  1. added
    bug
    P2
    sev-3
    on Nov 30, 2026
  2. added theissue type on Nov 30, 2026
  3. T4rk1n commented on Nov 30, 2026

    @T4rk1n
    Contributor

    Fix in progress in #4218.

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

Metadata

Metadata

Assignees

Labels

P2bugsev-3size: 1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions