2

Following is my code:

import gzip
import _pickle as cPickle

filename = "C:\\Users\\tende\\Desktop\\NLP\\hw2_package\\atis.small.pkl.gz"
f = gzip.open(filename,'rb')
train_set, valid_set, test_set, dicts = cPickle.load(f)

I am getting this error:

import gzip
import _pickle as cPickle

filename = "C:\\Users\\tende\\Desktop\\NLP\\hw2_package\\atis.small.pkl.gz"
f = gzip.open(filename,'rb')
train_set, valid_set, test_set, dicts = cPickle.load(f)
Traceback (most recent call last):

  File "<ipython-input-27-aecb21b3784f>", line 6, in <module>
    train_set, valid_set, test_set, dicts = cPickle.load(f)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 8: ordinal not in range(128)

Please tell me where am I going wrong. I am using Python 3.6.2

Aakanksha Choudhary
  • 515
  • 2
  • 5
  • 19
  • Maybe check out this answer: https://stackoverflow.com/questions/11305790/pickle-incompatability-of-numpy-arrays-between-python-2-and-3 – Kaiser Dandangi Nov 20 '17 at 02:25
  • @KaiserDandangi so it gives me the following error Traceback (most recent call last): File "", line 8, in p = u.load() File "C:\Users\tende\Anaconda3\lib\pickle.py", line 1050, in load dispatch[key[0]](self) KeyError: 31 – Aakanksha Choudhary Nov 20 '17 at 02:56

0 Answers0