So, again, I must start off apologising for the fact I am a complete newbie to Linux, Python and coding as a whole.
I have installed
python-docx to do a very simple task:
import shutil from docx import Document name = 'xxxxxxxxxx' source_path = r'/home/tye/Documents/xxxxxxxxxx/' template = r'template_xx' shutil.copytree(source_path+template, source_path+name) document = Document(source_path+name+'/correspondence/initial.docx') paragraph = document.add_paragraph ('helloworld') document.save=(source_path+name+'/correspondence/initial.docx')
whilst the folder copying bit works fine, the add paragraph doesn't. I get the same message each time:
'Document' object attribute 'save' is read-only'
I have tried running the file using sudo in the bash terminal, I have tried changing the user permissions on the document. I know I must be doing something incredibly simple wrong but I just can't figure out what :(
Grateful for any help...
ps, I have googled this loads of times.