Answer the question
In order to leave comments, you need to log in
How to fix an error while creating a file?
I'm trying to create a file from text that I store in the variable text
text='.......Текст файла'
dir = r"D:\Work\Project\test\object.gltf"
file = open(dir, 'w+')
file.write(text)
file.close()
Traceback (most recent call last):
File "generate.py", line 101204, in
file.write(text)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\encodings\cp1251. py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 821-824: character maps to
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question