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

Custom serializer for pathlib #106

Open
catchthemonster opened this issue Jan 28, 2025 · 2 comments
Open

Custom serializer for pathlib #106

catchthemonster opened this issue Jan 28, 2025 · 2 comments

Comments

@catchthemonster
Copy link

I do not see a generic way to introduce pathlib serializer and deserializer in Pyro5. I saw example for custom classes but I do not see in APi that I can do something like:
@Pyro5.serializers.serializer('pathlib)

Could you elaborate on this ...

@irmen
Copy link
Owner

irmen commented Jan 28, 2025

You'll have to register a serializer (possible more than 1?) for the classes found in pathlib. Serializers work on a per-type basis.

Is there a problem with the default way a pathlib.Path object is serialized?

@catchthemonster
Copy link
Author

I am using 3.13 Python. Yes when dict has key value pair with value as PosixPath then serpent serialization/de-serialization will fail.

I mean it is easier for me to just revert to string representation .as_posix() but I wanted to write custom serializer and go that way.
Frankly I do not like per-type or per-class serializes but I guess there is reason for that.

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