Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash on Windows crashes with Syntax Error due to forward slash in Windows path #3002

Open
SunnyBoyVivaldi opened this issue Sep 13, 2024 · 0 comments
Assignees
Labels
bug something broken P2 needed for current cycle

Comments

@SunnyBoyVivaldi
Copy link

SunnyBoyVivaldi commented Sep 13, 2024

I did a Quick-Fix to solve this issue for myself (see below), but I like to share my findings here and give opportunity to fix this properly.

Describe your context
I run JupyterLab Desktop on Windows 11 (64-bit)

Then I import dash like so:

from dash import Dash
from dash import dcc, html
from dash.dependencies import Input, Output
import plotly.express as px

Output of pip list is:

dash                      2.18.1
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0

Describe the bug
As soon as I run : app.run_server(mode='inline') an error is thrown with message:

[2024-09-13 15:41:45,496] ERROR in app: Exception on /_alive_0ded12ab-0b05-44c0-a874-6b2a8c7f5800 [GET]
Traceback (most recent call last):
File "\?[C:\Users\Gebruiker\AppData\Roaming\jupyterlab-desktop\jlab_server\Lib\site-packages\flask\app.py", line 1473](file:///C:/Users/Gebruiker/AppData/Roaming/jupyterlab-desktop/jlab_server/Lib/site-packages/flask/app.py#line=1472), in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

... ...

File "\?[C:\Users\User\AppData\Roaming\jupyterlab-desktop\jlab_server\Lib\site-packages\dash\dash.py", line 844](file:///C:/Users/Gebruiker/AppData/Roaming/jupyterlab-desktop/jlab_server/Lib/site-packages/dash/dash.py#line=843), in _relative_url_path
modified = int(os.stat(module_path).st_mtime)
^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 123] The syntaxis of filename, folder name or volume name is incorrect: '\\?\C:\Users\Gebruiker\AppData\Roaming\jupyterlab-desktop\jlab_server\Lib\site-packages\dash\deps/[email protected]'

And then an Internal Server Error

Expected behavior
At least not an error, I expect a nice chart or so

Quick Fix

As I have a local installation on my Windows PC, I fixed the problem by bluntly replacing the forward slash (/) with an escaped backslash:

in 'dash.py' I added in line 840:
relative_package_path = relative_package_path.replace("/", "\\")

If applicable, add screenshots or screen recording to help explain your problem.

@gvwilson gvwilson changed the title [BUG]Dash on Windows crashes with Syntax Error due to forward slash in Windows path Dash on Windows crashes with Syntax Error due to forward slash in Windows path Sep 16, 2024
@gvwilson gvwilson added bug something broken P2 needed for current cycle labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 needed for current cycle
Projects
None yet
Development

No branches or pull requests

3 participants