0

When I am trying unpickle preprocessed deap data file, the following error occurs:

File "D:/EEG_emotion_clasification-bd30dab4660735e8bb9c566f97b98b22ec8073f2/fitur_extraction/fft.py", line 210, in <module>
    dataset=pickle.load(open('D:\deap\data_preprocessed_python\s0'+str(i)+'.dat','rb'))

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

What should I do?

Mr. T
  • 11,960
  • 10
  • 32
  • 54
  • Why use pickle to open a dat file? just open(filepath) – Giuseppe Angora Jun 17 '18 at 09:39
  • Because its a preprocessed pickled file – Akanksha Singh Jun 17 '18 at 09:48
  • This has been mentioned in the official website: – Akanksha Singh Jun 17 '18 at 09:49
  • These files contain a downsampled (to 128Hz), preprocessed and segmented version of the data in Matlab (data_preprocessed_matlab.zip) and pickled python/numpy (data_preprocessed_python.zip) formats. This version of the data is well-suited to those wishing to quickly test a classification or regression technique without the hassle of processing all the data first. Each zip file contains 32 .dat (python) or .mat (matlab) files, one per participant. Some sample code to load a python datafile is below: import cPickle x = cPickle.load(open('s01.dat', 'rb')) – Akanksha Singh Jun 17 '18 at 09:49
  • Reading similar posts i've discovery that can be same problem of compatibility between file pickled with python 2.7 and python 3.6. What version are you using? – Giuseppe Angora Jun 17 '18 at 09:54
  • python 3.6, so i have used pickle instead of cpickle – Akanksha Singh Jun 17 '18 at 10:01

1 Answers1

0

you can do this instead:

with open(dat_file, 'rb') as f:
    x = cPickle.load(f, encoding='latin1')