Pickle EOFError: Ran out of input

240 Views Asked by At

Well I created a pickle file using this code:

if os.path.exists(f'{os.getcwd()}/GData.pkl'):
    with open(f'{os.getcwd()}/AllData.pkl','rb') as f:
        data,labels,db_labels,lng_labels= pickle.load(f)
        print(len(data))
else:
    #lets collect all the data
     g_data,g_labels,g_db_labels,g_lng_labels= Data_PreProcessing(Geisinger_data_list,'Geisinger')
    print('finished')

    data= g_data
    labels= g_labels
    db_labels= g_db_labels
    lng_labels= g_lng_labels


    with open('GData.pkl','wb') as f:
        pickle.dump(( data,labels,db_labels,lng_labels),f)

but then, when I do:

if os.path.exists(f'{os.getcwd()}/GData.pkl'):
    with open(f'{os.getcwd()}/GData.pkl','rb') as f:
        data,labels,db_labels,lng_labels= pickle.load(f)

I get EOFError: Ran out of input error, I can't find what is the issue, the pickle file exists and has 1.6Gbs so it is not supposed to be empty, why is the error?

0

There are 0 best solutions below