[Tutor] Stacks and Stack underflow/Stack overflow

Alan Gauld alan.gauld at btinternet.com
Sun Nov 20 00:27:42 CET 2011


On 19/11/11 19:37, Joe Batt wrote:

> File "/Users/joebatt/Desktop/python/pickling puzzle 5.py", line 39, in
> <module>
> a=pickle.load(file)
> _pickle.UnpicklingError: unpickling stack underflow
>
> when I am running the following
>
> import pickle
> file=open('///Users/joebatt/Desktop/banner.p.webarchive','rb')

I don't know why the error, it suggests the data file is corrupted.
You may need to fetch another copy. Make sure you save the file rather 
than try to open it so that it downloads in binary format or it may be 
truncated...


However, having downloaded it I'm not sure why you are specifying the 
filename with /// at the front. It looks like you are on Linux? You 
should only need

file=open('/Users/joebatt/Desktop/banner.p.webarchive','rb')

But that shouldn't really make any difference to the end result.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list