doc2vec_tf icon indicating copy to clipboard operation
doc2vec_tf copied to clipboard

Unicode Error- text file

Open Mustyy opened this issue 6 years ago • 1 comments

Any idea what I might be doing wrong?

UnicodeDecodeError Traceback (most recent call last) in () 8 for f in files: 9 file = open(f) ---> 10 words.append(file.read()) 11 file.close() 12

//ms/dist/python/PROJ/core/3.4.4/exec/lib/python3.4/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 0x92 in position 172: ordinal not in range(128)

Mustyy avatar Oct 29 '18 21:10 Mustyy

I would try file = open(f, encoding='utf-8') instead of file = open(f)

vastlik avatar Jan 23 '19 08:01 vastlik