Data saved from a ScriptPlugin in VRED 2020 with marshal.dump() cannot be loaded with marshal.load() in VRED 2021.
ValueError: bad marshal data (unknown type code)
Does anybody have a remedy for this?
Thanks!
Ingolf
Solved! Go to Solution.
Solved by sinje_thiedemann. Go to Solution.
Hi Ingolf,
I am not familiar with the marshal module, but I assume that it comes from the switch to Python 3.7.4 in VRED 2021 (from previous 2.7.10 in VRED 2020.3). You said that the data was saved in VRED 2020, so with Python 2.
From reading the documentation of marshal (here the version for Python 2: https://docs.python.org/2/library/marshal.html ), it sounds like this could very well be the reason. Blue highlighting by me:
>> This is not a general “persistence” module. For general persistence and transfer of Python objects through RPC calls, see the modules pickle
and shelve
. The marshal
module exists mainly to support reading and writing the “pseudo-compiled” code for Python modules of .pyc
files. Therefore, the Python maintainers reserve the right to modify the marshal format in backward incompatible ways should the need arise. If you’re serializing and de-serializing Python objects, use the pickle
module instead – the performance is comparable, version independence is guaranteed, and pickle supports a substantially wider range of objects than marshal. <<
Sorry, I do not have a solution for this, maybe someone else does.
Kind regards
Sinje
Can't find what you're looking for? Ask the community or share your knowledge.