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

DashProxy.hijack is not working anymore #147

Closed
RafaelWO opened this issue Apr 5, 2022 · 0 comments · Fixed by #148
Closed

DashProxy.hijack is not working anymore #147

RafaelWO opened this issue Apr 5, 2022 · 0 comments · Fixed by #148

Comments

@RafaelWO
Copy link
Contributor

RafaelWO commented Apr 5, 2022

As of the PR plotly/dash#1876, DashProxy.hijack(...) raises an AttributeError

>       _app.hijack(app)

../../conftest.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/foo/lib/python3.8/site-packages/dash_extensions/enrich.py:134: in hijack
    app.config.update(self.config)
/foo/lib/python3.8/site-packages/dash/_utils.py:116: in update
    self[k] = v
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {'name': 'conftest', 'assets_folder': '/src/assets', 'assets_url_path': 'assets', '...llbacks': False, 'show_undo_redo': False, 'extra_hot_reload_paths': [], 'title': 'Dash', 'update_title': 'Updating...'}
key = 'name', val = 'app'

    def __setitem__(self, key, val):
        if key in self.__dict__.get("_read_only", {}):
>           raise AttributeError(self._read_only[key], key)
E           AttributeError: ('Read-only: can only be set in the Dash constructor', 'name')

/foo/lib/python3.8/site-packages/dash/_utils.py:105: AttributeError

It seems that this is due to trying to .update() the whole config of a new app with the old one while dash restricts setting "read-only" keys in the dictionary.

Should be pretty easy to fix, IMO. I will prepare a PR if I have time.

P.S. See this comment to see my setup for .hijack().

I'm using dash==2.3.1

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