Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python-3.x

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' "

like image 617
Muhammad Asad Avatar asked Jul 29 '26 23:07

Muhammad Asad


1 Answers

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.

like image 88
wizzwizz4 Avatar answered Jul 31 '26 20:07

wizzwizz4



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!