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

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -