7

I'm trying to load the dumped files, using the following code:

cols = None
with open('./experiments/columns.p', 'rb') as p:
    cols = pkl.loads(p).read()

but i get this error instead:

"a bytes-like object is required, not '_io.BufferedReader' "

1
  • 1
    cols = pkl.loads(p.read()) Commented Dec 27, 2018 at 11:02

1 Answer 1

9

You're using pickle, so you should use the pickle.load function:

import pickle

with open('./experiments/columns.p', 'rb') as p:
    cols = pickle.load(p)

This is less likely to trigger a MemoryError.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.