Local variable 'bkey_hash' referenced before assignment

Friends,

Each step is a challenge, now to populate my table I’m getting the return below:

Traceback (most recent call last):
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\flask\app.py”, line 2525, in wsgi_app
response = self.full_dispatch_request()
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\flask\app.py”, line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\flask\app.py”, line 1820, in full_dispatch_request
rv = self.dispatch_request()
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\flask\app.py”, line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\dash\dash.py”, line 1259, in dispatch
ctx.run(
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\dash_callback.py”, line 439, in add_context
output_value = func(*func_args, **func_kwargs) # %% callback invoked %%
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\dash_extensions\callback.py”, line 171, in decorated_function
args[i] = self.cache.get(args[i])
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\cachelib\file.py”, line 205, in get
filename = self._get_filename(key)
File “c:\Users\EliasPai\kivy_venv\lib\site-packages\cachelib\file.py”, line 202, in _get_filename
return os.path.join(self._path, bkey_hash)
UnboundLocalError: local variable ‘bkey_hash’ referenced before assignment

Just below is my callback:

@cc.callback(Output('datatable-data', 'data'),
            Output('datatable-data', 'columns'), 
            [Input("store", "data"),
            Input('year-slider', 'value'),
            Input('drop-cidade', 'value'),
            Input('check-inline-mes', 'value'),
            Input(ThemeSwitchAIO.ids.switch("theme"), "value"),
            Input('drop-bairro', 'value'),])
def update_table(df, date, dropdown_cidade, mes, toggle, dropdown_bairro):
    template = template_theme1 if toggle else template_theme2

  if ('TODAS' in dropdown_cidade):
      mask = (df['ANO'] == date) & (df['OPERACAO'] == 'V') &  \
             (df['MES'].isin(mes)) & (df['CANCELADO'] != '*')
  else:
      mask = (df['ANO'] == date) & (df['OPERACAO'] == 'V') & \
             (df['CIDADE'].isin(dropdown_cidade)) & (df['BAIRRO'].isin(dropdown_bairro)) & \
             (df['MES'].isin(mes)) & (df['CANCELADO'] != '*')

  #'QT_PRATELEIRA', 'QT_DEPOSITO', 
  df_pivot = pd.pivot_table(
      df.loc[mask], index=['CODIGO', 'DESCRICAO',
                 'ESTOQUE', 'GRUPO',
                 'FAMILIA', 'UNIDADE',],
      values='QUANTIDADE',
      columns='MES',
      aggfunc=sum).reset_index().fillna(0)
  
  df_pivot = df_pivot.rename(
      {1: 'JAN', 2: 'FEV', 3: 'MAR', 4: 'ABR', 5: 'MAI', 6: 'JUN', 
       7: 'JUL', 8: 'AGO', 9: 'SET', 10: 'OUT', 11: 'NOV', 12: 'DEZ'}, axis=1)
  
  cols = []

  textCols = ['CODIGO', 'DESCRICAO', 'GRUPO', 'FAMILIA', 'UNIDADE']

  for i in df_pivot.columns:
      if i not in textCols:
          cols.append({"name": str(i),
                  "id": str(i),
                  "type": "numeric",
                  "format": formatted})
      else:
          cols.append({"name": str(i),
                      "id": str(i),
                      "type": "text"})



  return df_pivot.to_dict('records'), cols

#---------------------------------------------------------------------------------------------------------------------------
# This call registers the callbacks on the application.
cc.register(app)

I found the cause but not the solution yet.
The cause is because there are two Outputs, it seems that it is only accepting one return. That is, when it is conjugated it presents the error.

What version are you on?

In any case, please try updating to latest version of Dash and dash-extensions, and clear any local cache (e.g. on the filesystem).

It didn’t.
This is the list of applications involved:

Python==3.10.7
cachelib==0.9.0
dash==2.6.1
dash-bootstrap-components==1.2.1
dash-bootstrap-templates==1.0.7
dash-core-components==2.0.0
dash-extensions==0.0.23
dash-html-components==2.0.0
dash-table==5.0.0
Deprecated==1.2.13
distro==1.7.0
dnspython==2.2.1
docutils==0.19
Flask==2.2.2
Flask-Caching==2.0.1
Flask-Compress==1.12
numpy==1.23.2
oauth2client==4.1.3
openpyxl==3.0.10
pandas==1.4.4
plotly==5.10.0
protobuf==4.21.5
redis==4.3.4
toml==0.10.2

Your dash-extensions version is very old. The latest version is 0.1.7, please try upgrading to that one.

Now it is showing import errors:

File “c:\Users\EliasPai\DocumentsRIKA\DashRika\app.py”, line 29, in
from dash_extensions.callback import CallbackCache, Trigger
ModuleNotFoundError: No module named ‘dash_extensions.callback’

In the documentation I didn’t find this term.

I am basing this example on the link.

That link is to a very old post. Please refer to recent documentation,

Thank you very much for your help my brother!