I am trying to migrate project from Python 2 to Python 3. For this I used 2to3.exe. It made most of the things correct.
But my real problem is :
1. Data is stored by Python 2 Code. This data is very huge and I can't change it.
2. While reading this data in Python 3 getting error for marshalling and text data.
For text can we use decode function using latin-1
?
Marshal e.g. :
Python 2 code
import marshal
ad = {'a': 2319, 'b': '1', 'c': '1'}
marshalled_data = marshal.dumps(ad)
#'{t\x01\x00\x00\x00ai\x0f\t\x00\x00t\x01\x00\x00\x00ct\x01\x00\x00\x001t\x01\x00\x00\x00bR\x02\x00\x00\x000'
Python 3 code
import marshal
marshalled_data = b'{t\x01\x00\x00\x00ai\x0f\t\x00\x00t\x01\x00\x00\x00ct\x01\x00\x00\x001t\x01\x00\x00\x00bR\x02\x00\x00\x000'
ad = marshal.loads(marshalled_data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: bad marshal data (unknown type code)
Currently I don't see any option to have marshalling reading python 2 data in Python 3 code base. Has anyone worked on it?
It will be very helpful if any pointer is provided for further investigations.