Python error: EOFError: Ran out of input
Error when running pickle-related functions: EOFError: Ran out of input
Previous code.
>>> import pickle >>> s = pickle.load(fp) Traceback (most recent call last): File "<stdin>", line 1, in <module> EOFError: Ran out of input
Cause analysis: to open a file in file operation mode
Solution:
Change to the following method
>>> fp = open("a.txt","rb+") >>> import pickle >>> s = pickle.load(fp)#Serialized Print Results ['apple', 'mango', 'carrot']
Similar Posts:
- Python TypeError: file must have ‘read’ and ‘readline’ attributes
- [How to Solve Pytorch Error] EOFError: Ran out of input
- [Solved] PythonTypeError: ‘<' not supported between instances of 'str' and 'int'
- [Solved] Importerror: DLL load failed while importing mtrand: the specified program could not be found.
- docker:ImportError: libcuda.so.1: cannot open shared object file: No such file or directory
- How to use htmltestrunner.py to report importerror: no module named ‘stringio’ in Python 3
- [Solved] Tensorflow:ImportError: DLL load failed: The specified module cannot be found Failed to load the native TensorFlow runtime
- [Solved] pytorchImportError: numpy.core.multiarray failed to import
- Error report of cell timed task startup: KeyError: ‘scheduler’ KeyError: ‘entries’