I recently created piece of software in Python that uses docxcompose to copy a template from one location to a new document. I am able to run the program just fine before compiling into an EXE using pyinstaller. The traceback can be found below:
`File "MS_Word_Interface.py", line 63, in __init__
File "MS_Word_Interface.py", line 98, in create_document
File "MS_Word_Interface.py", line 142, in copy_contents_from_template_to_pretest_document
File "docxcompose\composer.py", line 53, in append
File "docxcompose\composer.py", line 61, in insert
File "docxcompose\properties.py", line 105, in __init__
File "docxcompose\properties.py", line 111, in _part_template
File "pkg_resources\__init__.py", line 1208, in resource_string
File "pkg_resources\__init__.py", line 1483, in get_resource_string
File "pkg_resources\__init__.py", line 1654, in _get
File "PyInstaller\loader\pyimod02_importers.py", line 228, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\*user*\\AppData\\Local\\Temp\\_MEI423562\\docxcompose\\templates\\custom.xml'`
It seems like the program is able to create the new document, but when copying from one of my pre-made documents, it is unable to access the copied data. Any help is appriciated.
I've tried running the EXE in administrator mode to no avail, I'm not sure what else to do, hence why I am reaching out here.
Line 142 is referring to "composer.append(self.input_document)" in the following code:
self.input_document = Document(f'{self.sub_documents_location}\\
{self.input_document_name}.docx')
composer = Composer(self.pretest_document)
composer.append(self.input_document)
composer.save(f"{self.location_of_document}\\
{self.name_of_output_document}")
Add
--collect-data "docxcompose"to your command line argument for pyinstaller