tags:

views:

36

answers:

2

I'm getting this error:

  File "C:\Python26\lib\pickle.py", line 1374, in loads
    return Unpickler(file).load()
  File "C:\Python26\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "C:\Python26\lib\pickle.py", line 1075, in load_obj
    k = self.marker()
  File "C:\Python26\lib\pickle.py", line 874, in marker
    while stack[k] is not mark: k = k-1
IndexError: list index out of range

Why could this be happening?

A: 

A "damaged file" is the general explanation; single most likely cause is that you forgot to open the file (in Windows) as 'rb' ("read binary") and the pickling was done with a binary protocol (i.e., any protocol except the old, slow default protocol 0, ascii only, that basically exists only for legacy purposes, makes larger files, and has several limitations).

Alex Martelli
A: 

Answer: I was trying to call pickle.loads() on the uninitialized field of a Google App Engine model.

Rosarch