0

I am trying to read a pickle file 'file.pkl' in windows.

I tried this:

import pandas as pd
import cPickle as cpkl
data = pd.read_pickle('file.pkl')

but I get the error: raise EOFError

This happens also if I try

import cPickle as cpkl
data = cpkl.load(open('file.pkl','rb'))

If I run this on linux there is no problem. How can I read this file on windows?

Thanks

AJaramillo
  • 400
  • 5
  • 18
  • How did you create the pickle file (was it created in pandas?), can you post the entire stack trace? – Andy Hayden Apr 14 '15 at 18:21
  • No I just receive the file from an old project without any info of the file. – AJaramillo Apr 14 '15 at 18:44
  • Have you tried python 2 and 3? If it's not created by pandas you won't be able to open it with pandas... – Andy Hayden Apr 14 '15 at 18:53
  • I used python 2.7 with anaconda, the second try was without pandas. – AJaramillo Apr 14 '15 at 19:03
  • pickling is different on different version of python, you should try in on python 3 too (not sure about pandas backwards compatibility). – Andy Hayden Apr 14 '15 at 19:07
  • @shx2 not sure this is a dupe, as I think the file was opened correctly (rb). – Andy Hayden Apr 14 '15 at 19:08
  • @AndyHayden while the question is not identical, it is very similar, and the answer applies to both (it addresses how to write, read, and how to convert an already-badly-written file). – shx2 Apr 14 '15 at 19:11
  • I tried following the advice of the alleged original of this dup, got the same error, even with 'rb' as an argument. I think this is a different problem. – Cartesian Theater Aug 13 '16 at 17:59

0 Answers0