0

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)

2
  • 2
    Please add the full error traceback to your question. Commented Feb 16, 2018 at 4:24
  • 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. Commented Feb 16, 2018 at 4:58

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.