TP-GAN icon indicating copy to clipboard operation
TP-GAN copied to clipboard

pickle 报错

Open ZHAIXINGZHAIYUE opened this issue 7 years ago • 1 comments

您好,您用的pickle模块的版本号是多少? 我在执行这一句时 self.data_dict = pickle.load(file) 遇到错误 ·UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence·

ZHAIXINGZHAIYUE avatar May 03 '18 06:05 ZHAIXINGZHAIYUE

Hello, are you using python 3? If yes, there is some pickle between python version problem. Instead of self.data_dict = pickle.load(file)

Please try this code:

with open('path/to/your/pickle/file','rb') as file: # Binary read
            u = pickle._Unpickler(file)
            u.encoding = 'latin1'
            p = u.load()
            self.data_dict = p

erikgajdos avatar May 03 '18 06:05 erikgajdos