+ 1

[Solved] Running app frozen with PyInstaller(used module pywebview)

Hi, I had created an app with pywebview and wanted to freeze it with PyInstaller. In the python code, I used a relative path for the html file link.(Resources\mainhtm.html). I used PyInstaller to freeze it with : PyInstaller -w -F --add-data "WebBrowserInterop.x86.dll;./" --add-data "Microsoft.Toolkit.Forms.UI.Controls.WebView.dll;./" --add-data "Microsoft.Toolkit.Forms.UI.Controls.WebView.LICENSE.md;./" --ADD-DATA "RESOURCES\MAINHTM.HTML;.\RESOURCES\MAINHTM.HTML" "File Name.py" (I hadn't written it in caps. I have written it here just to highlight it.) Everything works fine. But the problem is on opening the exe, I don't get the mainhtml but instead (see this) : https://drive.google.com/file/d/1podRqb4jXxkqNVBXAuk0lU8QaGgNQTQ1/view?usp=sharing Where clicking on the blue mainhtm.html link does the desired work. Why do I have to click it? Users shouldn't need to click it. It works when the file is not frozen. (I have the other add datas)(Am using platform Windows)

15th Nov 2019, 9:11 AM
Arnesh
Arnesh - avatar
2 Respostas
+ 1
The Problem is solved. The above command was putting the mainhtm.html in Resources\mainhtm.html\mainhtm.html. I modified the command to : PyInstaller -w -F --add-data "WebBrowserInterop.x86.dll;./" --add-data "Microsoft.Toolkit.Forms.UI.Controls.WebView.dll;./" --add-data "Microsoft.Toolkit.Forms.UI.Controls.WebView.LICENSE.md;./" --ADD-DATA "RESOURCES\MAINHTM.HTML;.\RESOURCES" "File Name.py" (not in caps) This worked.
15th Nov 2019, 9:24 AM
Arnesh
Arnesh - avatar
0
You good
8th Dec 2019, 10:28 PM
Hola Kola