João Areias
João Areias

Reputation: 1448

Problems unpickling object

I have this pickled object which I want to open but the idle is returning the error

TypeError: file must have 'read' and 'readline' attributes

Here is my code

openPrimorial = ('Primorial_pickled.txt','rb')
primorial = pickle.load(openPrimorial)
openPrimorial.close()

What am I doing wrong?

Upvotes: 1

Views: 911

Answers (1)

yole
yole

Reputation: 97178

You forgot to call the open() method. Your current code simply creates a tuple of two values; it doesn't open any file.

Upvotes: 4

Related Questions