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

copy broken by 2.4.0 #136

Open
bmerry opened this issue Jan 28, 2021 · 1 comment
Open

copy broken by 2.4.0 #136

bmerry opened this issue Jan 28, 2021 · 1 comment

Comments

@bmerry
Copy link

bmerry commented Jan 28, 2021

This code used to work (up to 2.3.0), but raises an error in 2.4.0:

#!/usr/bin/env python3

from addict import Dict

a = Dict().copy()
a.foo.bar

Output:

Traceback (most recent call last):
  File "copy-broken.py", line 6, in <module>
    a.foo.bar
  File "/home/bmerry/work/sdp/env3/lib/python3.8/site-packages/addict/addict.py", line 67, in __getattr__
    return self.__getitem__(item)
  File "/home/bmerry/work/sdp/env3/lib/python3.8/site-packages/addict/addict.py", line 70, in __missing__
    if object.__getattribute__(self, '__frozen'):
AttributeError: 'Dict' object has no attribute '__frozen'
bmerry added a commit to ska-sa/katsdpcontroller that referenced this issue Jan 28, 2021
bmerry added a commit to ska-sa/katsdpcontroller that referenced this issue Jan 29, 2021
@henvu50
Copy link

henvu50 commented Jul 2, 2021

I'm encountering this problem as well, from Ren'py, a visual novel design software.

init python:
    def test1():
        # When I click the first button that fires this function, the height value is set successfully.
        addict_dict.henry.height = "tall"

    def test2():
        # When I click the second button that fires this function, I get an error:
        # AttributeError: 'Dict' object has no attribute '__frozen'
       addict_dict.bob.height = "super tall"
       # if I do this 

error:

addict_dict.bob.height = "super tall"
  File "python-packages/addict/addict.py", line 67, in __getattr__
  File "python-packages/addict/addict.py", line 70, in __missing__
AttributeError: 'Dict' object has no attribute '__frozen'

RESOLUTION: The only way I figured out how to fix this is installing addict version 2.30 via pip, like this:

pip install --target game/python-packages addict==2.3.0
... or like this if you don't want it to go to a certain subdir:
pip install addict==2.3.0

In this link: https://github.com/mewwts/addict/releases/tag/v2.4.0 , it looks like a new feature was added in 2.4.0. Are we supposed to unfreeze our addict_dictionary before using it, would that make the above problem go away?

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

No branches or pull requests

2 participants