Код: Выделить всё
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:23:52) [MSC v.1900 32 bit (Intel)] on win32
Код: Выделить всё
Need to process 1 file(s)
Processing file test01.toml (1 of 1)
Traceback (most recent call last):
File "py/process.py", line 27, in
add_text_fragment(input_dir + "/" + file)
File "", line 10, in add_text_fragment
File "C:\Users\1\Anaconda3\lib\site-packages\toml\decoder.py", line 134, in lo
ad
return loads(f.read(), _dict, decoder)
File "C:\Users\1\Anaconda3\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 985: char
acter maps to
< /code>
Я предполагаю, что ошибка происходит где -то здесь: < /p>
f = open(toml_file_name, "r")
pt = toml.load(f)
f.close()
Как это исправить? addTextFragment.py < /p>
Код: Выделить всё
def add_text_fragment(toml_file_name):
f = open(toml_file_name, "r")
pt = toml.load(f)
f.close()
# If at this point pt contains dthe data of the input file,
# then you have attained the goal.
if (pt["type"] == "TA"):
Я стремлюсь решить это в Windows 10, Python 3.7.6 (по умолчанию, январь 8 2020, 20:23:39) [MSC V.1916 64 (AMD64) :: win32 .
Примечание: process.py выполняет addtextfragment.py для всех файлов в определенном каталоге.
Подробнее здесь: https://stackoverflow.com/questions/606 ... t-on-linux