python: pickle.load() raising EOFError
To load data, wouldn't you want to be reading data ("rb") instead of writing data ("wb")?
Loading data should look like this:
with open("C:/Users/Lab Komputasi/Documents/estu/filenamereal1.txt", "rb") as f:
data = pickle.load(f)
Also, using f.close() is unnecessary because you are using a with/as clause.
pickle.load() raising EOFError in Windows
Always use b
mode when reading and writing pickles (open(f, 'wb')
for writing, open(f, 'rb')
for reading). To "fix" the file you already have, convert its newlines using dos2unix
.
EOFError using pickle.load()
If you only have one dump
call, you should only have one load
call.
with open(filename, 'r') as f:
pos = pickle.load(f)
Python: EOF error in pickle.load
From the looks of it your cookie_store.dat
file is currently empty, because you are trying to load prior to saving the cookies on the following lines:
r = requests.post(url, data, cookies=load_cookies('cookie_store.dat'))
save_cookies(r.cookies, 'cookie_store.dat')
Related Topics
Python 3D Polynomial Surface Fit, Order Dependent
Formal and Actual Parameters in a Function in Python
Pyodbc Error Data Source Name Not Found and No Default Driver Specified Paradox
Python, Deleting All Files in a Folder Older Than X Days
Number of Common Letters in Two Strings
What Else Do I Need for Codehs 8.3.8: Word Ladder
Change Specific Value in CSV File Via Python
Dice Rolling Simulator in Python
How to Do This Horizontally Instead of Vertically in Python
Grab a Number After a String in a File
Finding the Maximum Number of Columns in a File or CSV Using Python
How to Skip Blank Line While Reading CSV File Using Python
How to Convert Float into Hours Minutes Seconds
What Is the Most Pythonic Way to Check If Multiple Variables Are Not None
Python: Import Cx_Oracle Importerror: No Module Named Cx_Oracle Error Is Thown
Could Not Find a Version That Satisfies the Requirement in Python