Does pickle serialization work in 4.47?
See original GitHub issueExcerpt from config documentation:
config item | type | default | meaning |
---|---|---|---|
SERIALIZERS_ACCEPTED | set | json,marshal, serpent | The wire protocol serializers accepted in the server/daemon. Use comma separated string for initial config, will be a set after initialization. |
So, I add this row to my source code:
Pyro4.config.SERIALIZERS_ACCEPTED = "json, marshal, serpent, pickle"
But get this error:
Traceback (most recent call last): File “/usr/local/lib/python3.4/dist-packages/Pyro4/util.py”, line 588, in get_serializer return _serializers[name] KeyError: ‘j’
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “g_term_server.py”, line 941, in <module> daemon = Pyro4.Daemon(port=3000) File “/usr/local/lib/python3.4/dist-packages/Pyro4/core.py”, line 919, in init self.__serializer_ids = {util.get_serializer(ser_name).serializer_id for ser_name in Pyro4.config.SERIALIZERS_ACCEPTED} File “/usr/local/lib/python3.4/dist-packages/Pyro4/core.py”, line 919, in <setcomp> self.__serializer_ids = {util.get_serializer(ser_name).serializer_id for ser_name in Pyro4.config.SERIALIZERS_ACCEPTED} File “/usr/local/lib/python3.4/dist-packages/Pyro4/util.py”, line 590, in get_serializer raise Pyro4.errors.SerializeError(“serializer ‘%s’ is unknown or not available” % name) Pyro4.errors.SerializeError: serializer ‘j’ is unknown or not available
If I changed the row to a list, it works fine:
Pyro4.config.SERIALIZERS_ACCEPTED = [“json”, “marshal”, “serpent”, “pickle”]
So, is it a mistake in documentation? Should I enter it as a list?
Another problem is that NameServer doesn’t work with pickle serialization. I have exported and restarted but it still doesn’t work:
export PYRO_SERIALIZERS_ACCEPTED=serpent,json,marshal,pickle
pyro4-ns
I got rid of Name Server and it works directly fine.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Regarding ‘initial config’: Aha! You meant operating system environment!
Regarding the Name Server problem: I am running only one NS, that is OK. But it is necessary to export in shell not only PYRO_SERIALIZERS_ACCEPTED, but PYRO_SERIALIZER too!
export PYRO_SERIALIZER=pickle
Without that, setting it in client python only will not help. It must be stated on both places. And it is not stated in documentation: see https://pythonhosted.org/Pyro4/nameserver.html#nameserver-pickle There is stated only PYRO_SERIALIZERS_ACCEPTED export necessary.
Could you add this info to the docs? It will really help people, I spent a lot of time trying to get it up.
Anyway, Pyro is a fantastic piece of software. It’s a hidden gem. I am really excited that I have discovered it. Great job!
Regarding SERIALIZERS_ACCEPTED; the datatype of that config item is a set, which it also says in the documentation. If you use a string it will iterate over the characters in the string which obviously doesn’t work. So yeah, you should use a list (or set, rather).
Regarding the name server: you’re doing something wrong, it works as you wrote. You don’t say what it is that “doesn’t work”. Have you enabled logging and checked if your options are recognized properly?