Hi,
Le 02/09/2019 à 22:43, Simon King a écrit :
> AFAIK, what I need to unpickle my old data is a way to tell Python-3
> that it shall (at least temporarily) unpickle all strings as bytes, in
> the sense that the pickled string  '\x80\x1f' should be understood as
> b'\x80\x1f'. Is there a way?

I tried to run the following two small scripts, and it didn't complain:


#!/usr/bin/python2

import pickle

s='\x80\x1f'
with open('/tmp/data.pickle', 'w') as handle:
    pickle.dump(s, handle, protocol=2)





#!/usr/bin/python3

import pickle

with open('/tmp/data.pickle', 'rb') as handle:
    s = pickle.load(handle, encoding='bytes')



I hope that helps,

JP

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/4347937a-bd99-b854-cf90-6bc0bb394358%40laposte.net.

Reply via email to