This repository was archived by the owner on Jul 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Dash Uploader callbacks fail in a Multi-page app with Dash Extensions #119
Copy link
Copy link
Open
Description
Hi,
I'm building a multi-page Dash application. It utilises functionality from the dash-extensions package, however I experience issues when I want to use a dash-uploader callback function.
The error I get is: AttributeError: 'DashProxy' object has no attribute 'blueprint'.
I managed to figure out that it occurs, because the DashProxy's callback method is using the blueprint attribute, however the du.callback is trying to call it before the attribute is assigned to the instance. I don't know how to work around this issue.
Note: I'm not sure if dash-uploader is supposed to work with dash-extensions and this is an issue or rather a feature request.
Here's how the code is structured:
app.py:
from dash_extensions.enrich import DashProxy, ServersideOutputTransform
app = DashProxy(__name__, use_pages=True, transforms=[ServersideOutputTransform()])
file_upload.py:
import dash
from dash import html, Output
import dash_uploader as du
app = dash.get_app()
du.configure_upload(app=app, folder='./uploads')
dash.register_page(__name__, path='/')
layout = html.Div(children=[
du_file_upload := du.Upload(id='du-file-upload'),
du_uploads := html.Div(id='du-uploads')
] )
@du.callback(
output=Output("du-uploads", "children"),
id="du-file-upload",
)
def get_a_list(filenames):
return html.Ul([html.Li(filenames)])
Here is the full Traceback:
Traceback (most recent call last):
File "/Users/user/PycharmProjects/machine-learning/ROICalculator/ticket_analysis/app.py", line 16, in <module>
app = DashProxy(__name__, use_pages=True, transforms=[ServersideOutputTransform()])
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash_extensions/enrich.py", line 352, in __init__
super().__init__(*args, **kwargs)
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash/dash.py", line 494, in __init__
self.init_app()
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash/dash.py", line 578, in init_app
self.enable_pages()
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash/dash.py", line 2044, in enable_pages
self._import_layouts_from_pages()
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash/dash.py", line 2016, in _import_layouts_from_pages
spec.loader.exec_module(page_module)
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/user/PycharmProjects/machine-learning/ROICalculator/ticket_analysis/pages/file_upload.py", line 101, in <module>
def get_a_list(filenames):
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash_uploader/callbacks.py", line 105, in add_callback
dash_callback = settings.app.callback(
File "/Users/user/virtualenv/ticket-analysis/lib/python3.8/site-packages/dash_extensions/enrich.py", line 358, in callback
return self.blueprint.callback(*args, **kwargs)
AttributeError: 'DashProxy' object has no attribute 'blueprint'
mrtnbrst
Metadata
Metadata
Assignees
Labels
No labels