My program is supposed to open a docx file 'Core.docx' with python-docx and does it just fine until I make an executable out of it with pyinstaller. I got the same error doing this on Windows 10 but was able to fix it by manually copying 'Core.docx' into the dist folder. On Mac, it doesn't solve it.
Error:
Traceback (most recent call last):
File "script.py", line 13, in <module>
File "docx/api.py", line 25, in Document
File "docx/opc/package.py", line 128, in open
File "docx/opc/pkgreader.py", line 32, in from_file
File "docx/opc/phys_pkg.py", line 30, in __new__
docx.opc.exceptions.PackageNotFoundError: Package not found at 'Core.docx'
[7946] Failed to execute script 'script' due to unhandled exception!
I've also tried the function --add-data after reading this exchange:
pyinstaller -F --add-data "Core.docx:Core.docx" script.py
It ran but nothing seems to have actually changed.
Does anyone know of any solutions?