Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1214

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

$
0
0

I am trying to run BookNLP model on a txt file in Colab, but I keep getting an error.

the code:

input_file="alice.txt"output_directory="alice"book_id="alice"booknlp.process(input_file, output_directory, book_id)

the error:

---------------------------------------------------------------------------UnicodeDecodeError                        Traceback (most recent call last)<ipython-input-16-7fd43958471a> in <cell line: 6>()      4 book_id="alice"      5 ----> 6 booknlp.process(input_file, output_directory, book_id)2 frames/usr/lib/python3.10/encodings/ascii.py in decode(self, input, final)     24 class IncrementalDecoder(codecs.IncrementalDecoder):     25     def decode(self, input, final=False):---> 26         return codecs.ascii_decode(input, self.errors)[0]     27      28 class StreamWriter(Codec,codecs.StreamWriter):UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)

Looking at other posts about the same error, I know I should set the encoding to UTF-8 but I am a bit unsure how to do that in this particular case.


Viewing all articles
Browse latest Browse all 1214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>