Python Forum
EOFError: Ran Out Of Input in Pickle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EOFError: Ran Out Of Input in Pickle
#1
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
Self-taught HTML, CSS, Python, and Java programmer
Reply
#2
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
To paraphrase: 'Throw out your dead' code. https://www.youtube.com/watch?v=grbSQ6O6kbs Forward to 1:00
Reply
#3
ok but


wut

I fixed it myself. I just had to dump it, then remove the code
Self-taught HTML, CSS, Python, and Java programmer
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 274 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  pickle problem DPaul 13 4,541 Sep-27-2022, 05:25 PM
Last Post: DPaul
  TypeError: cannot pickle n00sferatu 1 2,607 Dec-14-2021, 03:52 PM
Last Post: yakkaligiri
  Multiprocessing Can't pickle local object law 1 15,721 Aug-30-2021, 02:49 PM
Last Post: law
  Save/Loading using pickle Scordomaniac 4 2,977 Nov-24-2020, 06:11 PM
Last Post: Scordomaniac
  computing entropy using pickle files baran01 2 2,374 Dec-30-2019, 09:45 PM
Last Post: micseydel
  EOFError: EOF when reading a line - Runtime Error RavCOder 6 9,559 Sep-27-2019, 12:22 PM
Last Post: RavCOder
  Tkinter don't get ver from file via pickle storzo 2 2,520 Jul-31-2019, 03:50 PM
Last Post: storzo
  pickle docs say bytes in one place, strings in another Skaperen 2 2,107 Jul-29-2019, 05:13 PM
Last Post: Skaperen
  pickle error SheeppOSU 4 10,865 Apr-20-2019, 04:50 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020