Pytorch-RNN-text-classification icon indicating copy to clipboard operation
Pytorch-RNN-text-classification copied to clipboard

Update util.py

Open ghost opened this issue 6 years ago • 1 comments
trafficstars

edit function 'def create_tsv_file(path_in, path_out)' as: with open(path_in,'r', encoding = 'utf-8') as f, open(path_out,'w',encoding = 'utf-8') as fw:

or bug:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4757: ordinal not in range(128)

ghost avatar Jul 09 '19 08:07 ghost

Hi ArmstrongZhang, Thanks for your PR. This repo is originally implemented for Python2.7 and open does not take encoding as an argument in Python2.7. Can you use codecs.open instead? I believe codecs.open works fine both in python2 and 3. Thanks!

keishinkickback avatar Jul 09 '19 09:07 keishinkickback