Skip to content

Can't pickle the result of country_holidays #1236

@Mr-Geekman

Description

@Mr-Geekman

Currently, on Linux it isn't possible to pickle the result of calling country_holidays.

Code to reproduce:

import pickle
import holidays


def main():
    jp_holidays = holidays.country_holidays("JP")
    result = pickle.dumps(jp_holidays)


if __name__ == "__main__":
    main()

The error: _pickle.PicklingError: Can't pickle <function func at 0x7f9098a8dd30>: attribute lookup func on __main__ failed.

It fails not on all countries. For example, it works for US and UK.

The error starts from version 0.22 (on 0.22 it is slightly different).

The problem can be fixed by using dill, but may be it is possible to adjust the code to work with native pickle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions