question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does pickle serialization work in 4.47?

See original GitHub issue

Excerpt 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:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
miizacommented, Oct 6, 2016

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!

1reaction
irmencommented, Oct 6, 2016

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

pickle — Python object serialization — Python 3.11.1 ...
Serialization is a more primitive notion than persistence; although pickle reads and writes file objects, it does not handle the issue of naming...
Read more >
How pickle works in Python | Artem Golubin
The pickle module implements serialization protocol, which provides an ability to save and later load Python objects using special binary ...
Read more >
Change history — Celery 4.4.7 documentation
If the serializer argument is present but is 'pickle' , an exception will be raised as pickle-serialized objects cannot be deserialized without specifying...
Read more >
data serialization in Python with pickle - ZetCode
Serialization is the process of converting an object in memory to a byte stream that can be stored on disk or sent over...
Read more >
The ultimate guide to Python pickle - Snyk
In Python, you can use the built-in pickle library to handle this process. Pickle can serialize a Python object into a flat byte...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found