Search code examples
pythonpyinstallerpython-docx

How to fix PackageNotFoundError for exe files


It gives me the error only after I have converted it to an exe, works fine as a .py file

I tried to find the file missing and replace it but it still didn't work. The error I get is:

Traceback (most recent call last):

File "tkinter_init_.py", line 1705, in call

File "CompilerGui.py", line 259, in

done = ttk.Button(window, text="Compile", command=lambda:finish(texts, window, search_folder))

File "CompilerGui.py", line 210, in finish cb.the_main(q_list, values)

File "CompilerBase.py", line 323, in the_main

file_written = write_docx(values_dict, file_to_write)

File "CompilerBase.py", line 100, in write_docx

my_docx = docx.Document()

File "site-packages\docx\api.py", line 25, in Document

File "site-packages\docx\opc\package.py", line 128, in open

File "site-packages\docx\opc\pkgreader.py", line 32, in from_file

File "site-packages\docx\opc\phys_pkg.py", line 31, in new

docx.opc.exceptions.PackageNotFoundError: Package not found at 'C:\Users\LENOVO\AppData\Local\Temp_MEI92522\docx\templates\default.docx'


Solution

  • I figured out the solution to the problem, it was looking for a folder that didn't exist. Here's how I fixed it : https://youtu.be/bB9RXak4eVY