I have a problem with Pyinstaller, when I build the program everything works fine, but when I publish files on github or archive.org and download from there, when I try to run it, an error
Traceback (most recent call last):
File "my_app.py", line 28, in <module>
webview.start(gui="edgechromium", debug=False)
File "webview\__init__.py", line 174, in start
File "webview\guilib.py", line 134, in initialize
File "webview\guilib.py", line 83, in try_import
File "webview\guilib.py", line 72, in import_winforms
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "webview\platforms\winforms.py", line 13, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "clr.py", line 6, in <module>
File "pythonnet\__init__.py", line 143, in load
File "clr_loader\types.py", line 94, in get_function
File "clr_loader\types.py", line 58, in __init__
File "clr_loader\netfx.py", line 47, in _get_callable
RuntimeError: Failed to resolve Python.Runtime.Loader.Initialize from C:\Users\[USERNAME]\Downloads\application_folder\pythonnet\runtime\Python.Runtime.dll
my code:
import os
import sys
import webview
from pathlib import Path
HERE = Path(__file__).resolve().parent
INDEX = HERE / "launcher" / "index.html"
if not INDEX.exists():
raise FileNotFoundError(
f"{INDEX} not found."
)
url = INDEX.as_uri()
os.environ["WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS"] = \
"--autoplay-policy=no-user-gesture-required"
window = webview.create_window(
title="ChickenFine",
url=url,
fullscreen=True,
frameless=True,
resizable=True,
confirm_close=False
)
# edgechromium
webview.start(gui="edgechromium", debug=False)
I don't know what to do with this Can you tell me what the problem is?
Pythonwasn't created to make .exe file and programs likePyinstalleroften have problem to find all needed Python modules or C/C++ libraries which will be needed on other computer. You may see many question aboutPyinstalleron Stackoverflow. Maybe you should search on Stackoverflow if someone already had similar problem. Probably problem isedge chromium.Python.Runtime.dll. Maybe it can't find it or thisPython.Runtime.dlltried to load some other file (maybe other.dll) which it couldn't find (becausePyIntallerdidn't know that it has to add it to .exe and it may need to find out what file(s) it may need and add them manually to PyInstaller.specfile)