python - error in loading pickle -


not able load pickle file. using python 3.5

import pickle data=pickle.load(open("d:\\ud120-projects\\final_project\\final_project_dataset.pkl", "r")) 

typeerror: bytes-like object required, not 'str'

. .

also tried:

import pickle data=pickle.load(open("d:\\ud120-projects\\final_project\\final_project_dataset.pkl", "rb")) 

unpicklingerror: string opcode argument must quoted

. .

same errors when using statements

import pickle open("d:\\ud120-projects\\final_project\\final_project_dataset.pkl", "rb") f:     enron_data = pickle.load(f) 

you need "rb" read file, solves first problem.

the second issue (string opcode argument) because file doesn't have unix line endings. need run pkl file through script convert them. if see thread, there script called "dos2unix" solve you:

how convert dos/windows newline (crlf) unix newline (\n) in bash script?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -