我正在尝试将我制作的一个 sciter 项目打包在一起。在 sciter 中,它使用 .htm 和 .css 文件。所以我想将它包含在我的 .exe 中,而不必单独包含它们。以下是我在 Python 代码中使用 HTML 文件的方式:
# create window
frame = Frame()
# load file
frame.load_file("index.htm")
# install additional handler
ev2 = RootEventHandler(frame.get_root(), frame)
frame.run_app()
以下是我使用 PyLauncher 创建 exe 的方法:
pyinstaller --add-binary "index.htm;index.css" launcher.py --onefile
注意:我在 Windows 上运行它。
当我运行我的启动器时,它说:
sciter.error.SciterError: Unable to load file file://C:/Users/user/launcher/dist/index.htm
[14684] Failed to execute script launcher
如果我放置 index.htm 文件和 index.css 文件,它可以正常工作。很明显,它期望这些文件包含在目录中。