Summary
I am trying to use the package pdfkit (version 0.6.1) and wkhtmltopdf (version 0.12.6.0) to convert HTML to PDF.
I can use the script, until I try to convert it to an .exe file using cx_freeze.  Then it fails. Using the executable, I get the following error:
Error
Exception in thread Thread-109:
Traceback (most recent call last):
  File "C:\Users\Diego\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Diego\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Diego\Pictures\Zona Python\GuideMath\src\interfaz\VentanaExportar.py", line 132, in __exportarHTMLaPDF
    self.__resultado = self.__ctrl.exportarHTMLaPDF(
  File "C:\Users\Diego\Pictures\Zona Python\GuideMath\src\controlador\Controlador.py", line 142, in exportarHTMLaPDF
    return "E" if pdfkit.from_url(
  File "C:\Users\Diego\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pdfkit\api.py", line 26, in from_url
    return r.to_pdf(output_path)
  File "C:\Users\Diego\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pdfkit\pdfkit.py", line 156, in to_pdf
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Loading pages (1/6)
Warning: Javascript alert: Hola
QPainter::begin(): Returned false============================] 100%
Error: Unable to write to destination
Exit with code 1, due to unknown error.
Relevant Code Snippet
pdfConf = pdfkit.configuration(wkhtmltopdf=os.path.join(
            self.__principalPath, "docs/web/PDF/wkhtmltopdf.exe"))
pdfOpti = {
            "window-status": "print",
            "dpi": "90",
            # "quiet": "",
            "page-size": "A4",
            "footer-html": f"{url}/footer.html"
        }
try:
            return "E" if pdfkit.from_url(
                url=f"{url}/document.html",
                output_path=outputPath,
                configuration=pdfConf,
                options=pdfOpti) else "F"
except:
            return "F"
Other
I searched on the internet and I found that the problem might be the destination path. But I am using the complete path: C:\Users\Diego\Desktop\JAA.pdf
Setup File
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["ctypes", "os", "wx", "json", "threading", "pdfkit"],
    "excludes": ["tkinter"]}
base = None
if sys.platform == "win32":
    base = "Win32GUI"
setup(name="App",
      version="0.1",
      description="",
      options={"build_exe": build_exe_options},
      executables=[Executable("main.py", base=base, icon="app.ico")])