I'm trying to store 5000 data elements on an array. This 5000 elements are stored on an existinng file (therefore it's not empty).
But I'm getting an error.
Code
def array():
name = 'puntos.df4'
m = open(name, 'rb')
v = []*5000
m.seek(-5000, io.SEEK_END)
fp = m.tell()
sz = os.path.getsize(name)
while fp < sz:
pt = pickle.load(m)
v.append(pt)
m.close()
return v
Output:
line 23, in array
pt = pickle.load(m)
_pickle.UnpicklingError: invalid load key, ''.