Cannot Pickle Model Via Python Scope

I am trying to load this python file via a python scope but UiPath crashes with a ‘Pipe is Broken’ error.

Link to pickled model: pickled_model.sav - Google Drive

Python Script:

import pickle
import numpy as np



def predict_label(x_test):
    filename = 'D:\\My POCs\\UiPath - Pickled Model\\pickled_model_2.pkl'

    loaded_model = pickle.load(open(filename, 'rb'))
    file1 = open("D:\\My POCs\\UiPath - Pickled Model\\Model_pickling\\myfile.txt","w")
    file1.write(x_test)
    file1.write('\n')
    file1.close()

I know I have chosen the right activities because this script works when I comment out the pickle.load command.

Thanks

Hi @Rohaan_Nadeem2

I am not sure if that will solve your issue, but maybe you could have a look at this simple post:

1 Like

Hey @loginerror

This was the a brilliant suggestion. I ran the script on CMD and realized the base environment was missing 1 library. Once I installed it, the program has been running flawlessly.

Thanks!!

1 Like