0
votes

When I am loading a file using pickle.load at that time I am facing this error.

with open("tfidf_vectorizer", mode='r+b') as handle:                            
    tfidf_vectorizer = pickle.load(handle)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xdb in position 0: ordinal not in range(128)

1
Please add the full error traceback to your question. - Klaus D.
why is it that your file tfidf_vectorizer has no extension. Shouldn't it be something like tfidf_vectorizer.json or something like that @KlausD. - Clock Slave

1 Answers

1
votes

Try setting an encoding when reading the file.

Ex:

with open("tfidf_vectorizer", mode='r+b', encoding='utf-8') as handle:                            
    tfidf_vectorizer = pickle.load(handle)