[Tutor] pickle module error in source code

Peter Otten __peter__ at web.de
Thu Jan 1 20:06:09 CET 2015

Vedhi Shreya Marwaha wrote:

> Hi! My name is Shreya Marwaha. I’m class 12th student in India. 


> I’m using
> 2.7.5 python version [MSC v.1500 64 bit (AMD64)] on win32 as instructed by
> CBSE (central board of secondary education). I’ve been having problem in
> using pickle module. It keeps on showing error in the source code.   I’ve
> attached two files: 1.   Prax.py file with error1.txt 2.   Video.py file
> with error.txt   Prax.py file is a simple problem, the first program I
> tried with pickle module. Video.py is my project which I’ll be submitting
> at the end of my year at school i.e. February 2015. I’ve attached two text
> documents in which both are showing the error occurring in both the
> problems. The errors in both the programs are similar.   Please help me in
> this context.   -Shreya Marwaha

I'm sorry I am not prepared to read this much code. It is both courteous and 
helpful to reduce a problem to the smallest amount of code that still shows 
the bug. Read http://sscce.org/ for the details.

On the positive side, thank you for providing version info and tracebacks! 

> Traceback (most recent call last): 
>    File "C:\Users\Home\Desktop\Project\Video.py", line 678, in <module> 
>      main() 
>    File "C:\Users\Home\Desktop\Project\Video.py", line 627, in main 
>      M.Master_Display() 
>    File "C:\Users\Home\Desktop\Project\Video.py", line 109, in 
>      MRec = load(Mobj) 
>    File "C:\Python27\lib\pickle.py", line 1378, in load 
>      return Unpickler(file).load() 
>    File "C:\Python27\lib\pickle.py", line 858, in load 
>      dispatch[key](self) 
>    File "C:\Python27\lib\pickle.py", line 886, in load_proto 
>      raise ValueError, "unsupported pickle protocol: %d" % proto 
>  ValueError: unsupported pickle protocol: 3

This one leads me to believe that you ran some of your code with Python 3 
and thus have accidentally created a pickle file that cannot be read by 
Python 2. Delete your existing pickle files and try again.

If it doesn't work out come back with a smaller more focused example.

More information about the Tutor mailing list