Python Forum
EOFError: Ran Out Of Input in Pickle - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: EOFError: Ran Out Of Input in Pickle (/thread-11346.html)



EOFError: Ran Out Of Input in Pickle - Panda - Jul-04-2018

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



RE: EOFError: Ran Out Of Input in Pickle - ljmetzger - Jul-04-2018

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


RE: EOFError: Ran Out Of Input in Pickle - Panda - Jul-05-2018

ok but


wut

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