-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Unbound local variable bkey_hash (from cachelib) when providing State of Store in callback that has ServersideOutput of same Store #178
Comments
I just tried to run your example. On my systems (I tried on my OSX laptop, and on my Windows WSL2 system), it runs without any errors. What more is, I don't even have |
Thanks for your reply @emilhe . Here is my
dash-extensions uses flask-caching, which in turn uses cachelib according to https://github.com/pallets-eco/flask-caching/blob/master/src/flask_caching/backends/filesystemcache.py#L17 . See also pallets-eco/flask-caching#308 for the PR. I don't know why your system does not use cachelib, it seems like it should no? Maybe some caching or outdated requirement versions somewhere? The PR that introduced cachelib in flask-caching is from May 28th so a while ago already, and that same day 1.11.1 was released on PyPi. My older environment (as opposed to a newly created venv) also works and also does not use cachelib, and there it uses flask-caching version 1.10.1 as opposed to the latest 1.11.1. I can't find the exact version-bump in the code, but I'm guessing 1.11.1 introduced cachelib. It also seems like that introduced some other bugs, see https://github.com/pallets-eco/flask-caching/issues . Maybe it's a simple temporary fix to pin flask-caching version requirement to 1.10.1? I just checked in my own environment that that indeed solves the issue at least. |
Ah yes, now I am able to reproduce the issue. I have defined the dependency as,
My local .lock files where all pinned at 1.10.1, similar to the repo, so I didn't see any issues. Manually upgrading to 1.11.1, I also get the error. It looks like a bug in cachelib, so I would say the solution is to downgrade. I'll try to pin the dependency from my side. |
The issue should be resolved in version |
Hi @emilhe |
@kennethfungch did you clear the cache folder(s)? The fix is not backwards compatible, so if you have old cache files laying around, they might cause issues. |
@emilhe yes I have removed the cache folder (file_system_store) and it doesn't work unfortunately. |
I tried @matthiasschuurmans example and have the same issue with dash_extensions==0.1.4 and the prerelease 0.1.5rc2. I also tried deleting file_system_store before starting the app. |
Ah, yes, I can see that this error was do to a composite bug, of which only the first part was fixed in the |
This worked for me, just updated to dash-extensions 0.1.5 , thanks! |
Hi, thanks a lot for this package, it's helping me a lot with making dashboards!
Unfortunately, I'm getting
UnboundLocalError: local variable 'bkey_hash' referenced before assignment
from cachelib when I add a store as both ServersideOutput and State for a callback. I want to do this, so that I can first check if the store contains the data I need, before doing an expensive query to get that data and update the store. Somehow, this was working not so long ago, but I can't really track down exactly what changed, so I'm hoping you can help me.I made a minimum reproducible example based on https://www.dash-extensions.com/transforms/serverside-output-transform:
The error comes from cachelib, https://github.com/pallets-eco/cachelib/blob/main/src/cachelib/file.py#L186 .For some reason,
key
is None, and so it does not createbkey_hash
and produces the error when returningos.path.join(self._path, bkey_hash)
Versions:
dash: 2.4.1
dash-extensions: 0.1.3
cachelib: 0.7.0
Steps to reproduce:
pip install dash-extensions
andpip install pandas
(apparently pandas is not a requirement of dash-extensions, even though it raisesImportError: Plotly express requires pandas to be installed.
)Thank you for your time and effort!
The text was updated successfully, but these errors were encountered: