Answer the question
In order to leave comments, you need to log in
Doxtpl does not understand the encoding, how to fix it?
When substituting values into a docx template using jinja2 and doxtpl, it gives the error "'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)"
How can I fix it?
The code is like this:
from docxtpl import DocxTemplate
doc = DocxTemplate("./tracker/media/company2.docx")
context = {'company_name':task_list}
doc.render(context)
src = "./tracker/media/Report_" + datetime.datetime.now().strftime(
"%d_%m_%Y_%H:%M") + ".docx"
doc.save(src)
Answer the question
In order to leave comments, you need to log in
Maxim Kovalev well, it seems to me that you should not use a colon in the file name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question