0

I am trying to load a .dat file (RML2016_10b.dat) radio dataset from DeepSig using _pickle in Python 3.6 as follows:

from _pickle import load, dump
Xd = load(open("RML2016_10b.dat", 'rb'))

But I keep getting the following error:

Traceback (most recent call last):
  File "C:/Users/anoir/PycharmProjects/AMC/classification.py", line 14, in <module>
    Xd = load(open("RML2016_10b.dat", 'rb'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 0: ordinal not in range(128)

Can anyone give me a solution?

4
  • 1
    Might be the case that the file was created with python2. Try this answer: stackoverflow.com/questions/28218466/… Commented Mar 17, 2019 at 17:38
  • yes but i cannot use python 2 because i have to use tensorflow which does not work with python 2 Commented Mar 17, 2019 at 17:41
  • 1
    Read the answer: d = pickle.load(f, encoding='latin1') Commented Mar 17, 2019 at 17:42
  • yes i am trying it now ... i just wanted to explain Commented Mar 17, 2019 at 17:44

1 Answer 1

0

Thanks to H4Kor the from _pickle import load, dump

from _pickle import load, dump
Xd = load(open("RML2016_10b.dat", 'rb'), encoding='latin1')
Sign up to request clarification or add additional context in comments.

1 Comment

You don't need to explicitly import _pickle in Python 3. See What difference between pickle and _pickle in python 3?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.