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

[BUG] NoUpdate.is_no_update can't handle ndarray #2173

Closed
maor1993 opened this issue Jul 31, 2022 · 0 comments · Fixed by #2175
Closed

[BUG] NoUpdate.is_no_update can't handle ndarray #2173

maor1993 opened this issue Jul 31, 2022 · 0 comments · Fixed by #2175

Comments

@maor1993
Copy link

Describe your context
currently running project using dash for data display, callbacks pass ndarrays of certain sections of data to view

dash                      2.6.0
dash-bootstrap-components 1.2.0
dash-core-components      2.0.0
dash-daq                  0.5.0
dash-extensions           0.1.5
dash-html-components      2.0.0
dash-table                5.0.0

Describe the bug
if callback passes an ndarray, NoUpdate.is_no_update on line 441 of _callback.py raises a ValueError, this issue was not seen in previous versions.

[2022-07-31 16:27:03,570] ERROR in app: Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "...\venv\lib\site-packages\flask\app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "...\venv\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "...\venv\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "...\venv\lib\site-packages\flask\app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "...\venv\lib\site-packages\dash\dash.py", line 1260, in dispatch
    ctx.run(
  File "...\venv\lib\site-packages\dash\_callback.py", line 441, in add_context
    if NoUpdate.is_no_update(output_value):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Workaround for this is wrapping ndarray with list, like this:

return [myndArr]
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 a pull request may close this issue.

1 participant