-
Notifications
You must be signed in to change notification settings - Fork 129
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
"Exception in ASGI application" when using leaflet module (with ipyleaflet) #1240
Comments
It is odd, because i think this worked at some point but either we must have regressed it or the library changed something that we don't handle properly. I will look into this |
This actually might be an error upstream The HTML output from |
Confirmed - when switching from https://cdn.jsdelivr.net/npm/jupyter-leaflet@0.18.0/ e.g. Do you mind filing a ticket upstream? |
Hi! Thanks a lot for looking into this! Indeed, when I install 0.18.0 it works (i.e., the map is displayed). However, it actually surprises me that it works because it still throws the same error 🤔 This is what it looks like with 0.18.0 (where the map is displayed -- there are a couple of exceptions coming up in the Firefox debugger but they might be unrelated), Perhaps there are two problems here, one in marimo (leading to the ValueError exception) and one in v0.19.0 of leaflet (making it no longer work as opposed to 0.18.0)? I am happy to file a bug ticket in their tracker, however, I haven't understood how you found out that leafmap.Map is looking for the wrong path? |
Yea - I still saw the 404 on
I just bisected between 0.18.0 and 0.19.0 and noticed the path changed in the network tab. |
Describe the bug
The code below throws the following exception:
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "[home]/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "[home]/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call
return await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "[home]/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "[home]/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/middleware/authentication.py", line 49, in call
await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/marimo/_server/api/middleware.py", line 49, in call
return await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 65, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "[home]/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 776, in app
await route.handle(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 485, in handle
await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 776, in app
await route.handle(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 297, in handle
await self.app(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "[home]/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "[home]/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "[home]/.local/lib/python3.8/site-packages/starlette/routing.py", line 72, in app
response = await func(request)
File "[home]/.local/lib/python3.8/site-packages/marimo/_server/router.py", line 89, in wrapper_func
response = func(request=request)
File "[home]/.local/lib/python3.8/site-packages/marimo/_server/api/endpoints/assets.py", line 106, in virtual_file
buffer_contents = read_virtual_file(filename, int(byte_length))
ValueError: invalid literal for int() with base 10: 'jupyter'
The reason is, as far as I can tell, that it is trying to load an asset with filename 'jupyter-leaflet.js' (and some others) where contrary to the assumption made in the code no file length is prepended as "N-" so it tries to parse "jupyter" as a number.
Environment
{
"marimo": "0.4.5",
"OS": "Linux",
"OS Version": "5.4.0-176-generic",
"Processor": "x86_64",
"Python Version": "3.8.10",
"Binaries": {
"Browser": "124.0.6367.60",
"Node": "v18.20.0"
},
"Requirements": {
"click": "8.1.3",
"importlib-resources": "6.4.0",
"jedi": "0.18.0",
"markdown": "3.5",
"pymdown-extensions": "10.7.1",
"pygments": "2.16.1",
"tomlkit": "0.12.4",
"uvicorn": "0.29.0",
"starlette": "0.37.2",
"websocket": "missing",
"typing-extensions": "4.8.0",
"black": "23.3.0"
}
}
Code to reproduce
import leafmap
m = leafmap.Map(center=(40, -100), zoom=4)
m
The text was updated successfully, but these errors were encountered: