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

TypeError: Item in jsons.__all__ must be str, not function #172

Open
nightan42643 opened this issue Jun 15, 2022 · 1 comment
Open

TypeError: Item in jsons.__all__ must be str, not function #172

nightan42643 opened this issue Jun 15, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@nightan42643
Copy link

nightan42643 commented Jun 15, 2022

Hey, there may be a bug in the __init__.py I think.

When I try from jsons import * I got an error: TypeError: Item in jsons.__all__ must be str, not function

And I checked your __init__.py and found below may be a bug:

if default_zone_info_serializer and default_zone_info_deserializer:
    from zoneinfo import ZoneInfo
    __all__.append(default_zone_info_serializer)
    __all__.append(default_zone_info_deserializer)
    set_serializer(default_zone_info_serializer, ZoneInfo)
    set_deserializer(default_zone_info_deserializer, ZoneInfo)

The two append line appended function into it, so I try to change it like below:

if default_zone_info_serializer and default_zone_info_deserializer:
    from zoneinfo import ZoneInfo
    __all__.append(default_zone_info_serializer.__name__)
    __all__.append(default_zone_info_deserializer.__name__)
    set_serializer(default_zone_info_serializer, ZoneInfo)
    set_deserializer(default_zone_info_deserializer, ZoneInfo)

After this change, from grammar can work normally.

@ramonhagenaars ramonhagenaars added the bug Something isn't working label Jul 26, 2022
@ramonhagenaars
Copy link
Owner

Thanks for reporting, that's a bug indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants