I have a use case to read a Python object serialized using pickle in java. I was hoping to do this by using pickle in jython. Can someone give a small example of how this can be accomplished.
Asked
Active
Viewed 98 times
0
-
1`cpickle` does not exist in Python 3.x – martineau Aug 13 '21 at 07:43
-
@martineau ok but what about 2.7. can you give me an example using that – Ujjwal Pathak Aug 13 '21 at 10:57
-
1I don't quite understand your question. You have pickled some object and want to unpickle it in Java? – user8408080 Aug 13 '21 at 11:07
-
Doesn't jython include a `pickle` module? Why exactly do you want to use `cpickle`? – martineau Aug 13 '21 at 11:24
-
No jython latest version is 2.7.2 and it only has cPickle which is not in Python 3.x – Ujjwal Pathak Aug 13 '21 at 13:34
-
@user8408080 Yes that is exactly what I'm trying to do, but so far I don't see any way that is possible – Ujjwal Pathak Aug 13 '21 at 13:38
-
Do you know, which protocol version your file is pickled with? – user8408080 Aug 13 '21 at 18:18
-
1[This](https://stackoverflow.com/questions/21794750/read-python-pickle-data-stream-in-android/21801219#21801219) looks promising – user8408080 Aug 13 '21 at 18:21
-
1In Python 3, `cPickle` was renamed `_pickle` — see [What difference between pickle and \_pickle in python 3?](https://stackoverflow.com/questions/19191859/what-difference-between-pickle-and-pickle-in-python-3). – martineau Aug 16 '21 at 11:20