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

state_pickler.get_state fails for attributes resulting in StateTuple #300

Open
johannesloibl opened this issue Oct 27, 2021 · 0 comments
Open

Comments

@johannesloibl
Copy link

johannesloibl commented Oct 27, 2021

from traits.api import HasTraits, Dict, Str, Tuple, List
from apptools.persistence import state_pickler as sp


class Model(HasTraits):
    dict_item = Dict()
    tuple_item = Tuple()
    str_item = Str()
    list_item = List()


def main():
    inner = Model(
        dict_item=dict(a=1),
        tuple_item=(1, 2, 3),
        str_item="bla",
        list_item=[4, 5, 6]
    )
    outer = Model(
        dict_item=dict(a=inner),
        tuple_item=(inner, inner),
        str_item="blubb",
        list_item=[inner, inner]
    )

    state = sp.get_state(outer)


if __name__ == '__main__':
    main()

This results in following exception:
image

Removing tuple_item=(inner, inner), makes it work again.

OS: Win 10
Pkg Versions:
traits==6.3.1
apptools==5.1.0

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

1 participant