Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard example doesn't work. #106

Open
Ada-lave opened this issue Apr 30, 2024 · 0 comments
Open

Standard example doesn't work. #106

Ada-lave opened this issue Apr 30, 2024 · 0 comments

Comments

@Ada-lave
Copy link

Ada-lave commented Apr 30, 2024

When i trying render a docx using standard example i get this error

Traceback (most recent call last):
  File "C:\Users\megak\Desktop\study\3 курс\practic 3\giga\main.py", line 10, in <module>
    doc.render(context)
  File "C:\Users\megak\Desktop\study\3 курс\practic 3\giga\venv\Lib\site-packages\docxtpl\template.py", line 382, in render
    for relKey, xml in headers:
  File "C:\Users\megak\Desktop\study\3 курс\practic 3\giga\venv\Lib\site-packages\docxtpl\template.py", line 338, in build_headers_footers_xml
    for relKey, part in self.get_headers_footers(uri):
  File "C:\Users\megak\Desktop\study\3 курс\practic 3\giga\venv\Lib\site-packages\docxtpl\template.py", line 324, in get_headers_footers
    for relKey, val in self.docx._part._rels.items():
                       ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DocumentPart' object has no attribute '_rels'. Did you mean: 'rels'?

My code:

from docxtpl import DocxTemplate

doc = DocxTemplate("t.docx")

context = {

    'text':"memememe"
}

doc.render(context)
doc.save(b"tesxt.docx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant