Python Forum

Full Version: EOFError: Ran Out Of Input in Pickle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is a snippet of code that is causing an error
import pickle
amount_of_accounts = pickle.load( open( "savek.p", "rb" ) )
This gives the error:
Error:
Traceback (most recent call last): File "Python.py", line 4, in (module) amount_of_accounts = pickle.load( open( "savek.p", "rb" ) ) EOFError: Ran out of input
Your error is typical of pickle file savek.p that exists, but is empty.


When I replace the actual pickle file contents with the following text:
Output:
xxx yyy zzz
the following Traceback error occurs:
Error:
Traceback (most recent call last): File "Pickle-002.py", line 4, in <module> favorite_yankees = pickle.load( open( "Pickle-001.p", "rb" ) ) _pickle.UnpicklingError: invalid load key, 'x'.

When I replace the actual pickle file contents with the following text:
Output:
hello world this is a corrupted pickle file
the following Traceback error occurs:
Error:
Traceback (most recent call last): File "Pickle-002.py", line 4, in <module> favorite_yankees = pickle.load( open( "Pickle-001.p", "rb" ) ) KeyError: 101
Please note that the pickle file has a non-ASCII (non utf-8) hex format that is not meant to be edited.

Lewis
ok but


wut

I fixed it myself. I just had to dump it, then remove the code