Path(__file__).parent / "worddoc.docx" not working

Viewed 10

I am completely new to Python. I am watching a guide on creating Data Entry Forms for Word. The guide has instructed me to install docxtpl pip install docxtpl

First question: Where dit it install this? Where can I find these files now?

Next instructions were to from pathlib import Path from docxtpl import DocxTemplate

I assume running this enables me to use commands 'Path' and 'Docxtemplate' from the docxtpl package. (It's a package, right? And these are commands?)

Next up - and here is where my Jupyter Notebook returns 'invalid syntax': document_path = Path(C:\Users*pathing*\Python_template_BvW.docx).parent / "Python_template_BvW.docx"

I get that I am linking the text document_path to a value - and that the value here is the Path to the parent directory of my template Word file, the file I will later on create a data entry form for. However I get: File "", line 1 document_path=Path(C:\Users*pathing*\Data_Entry_for_Word\Python_template_BvW.docx).parent / "Python_template_BvW.docx" ^ SyntaxError: invalid syntax

Please, help. Why is the Syntax wrong? I've completely copied the guide so far.

Thank you for your advice and help.

Kind regards, Nicolas

0 Answers
Related