FHPythonUtils / Cli2Gui

Use this module to convert a cli program to a gui
MIT License
90 stars 7 forks source link

Bug: crash on windows exe packaged by pyinstaller #17

Closed mokurin000 closed 1 month ago

mokurin000 commented 1 month ago

Before You Begin

Before proceeding, please make sure to follow these steps:

Issue Details

I used my package script

$project = "fuckingfast_batch_download"
micromamba create -n $project "python<3.12"
micromamba activate $project

pip install -e .
pip install pyinstaller

$ENV:PLAYWRIGHT_BROWSERS_PATH = 0
$ENV:HTTPS_PROXY = "http://127.0.0.1:7890"

$CLEAN_OPT = '--clean', '--noconfirm'
$HIDE_WINDOW = '--noconsole'

playwright install chromium

pyinstaller --hidden-import=tkinter --optimize 2 -D -n scrap-gui @CLEAN_OPT $HIDE_WINDOW src/$project/source/fitgirl/gui.py
pyinstaller --hidden-import=tkinter --optimize 2 -D -n extract-gui @CLEAN_OPT src/$project/gui.py

# Optional, comment this to debug pyinstaller spec.
Remove-Item *.spec
# Clean build cache directory
Remove-Item -Recurse -Force build\

to package fuckingfast-batch-download

then I get these error:

Exception: Error: [1000] Message:       Font file could not be found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "gui.py", line 14, in <module>
  File "cli2gui\decorators.py", line 288, in inner
  File "__main__.py", line 146, in main
  File "cli2gui\decorators.py", line 258, in runCli2Gui
  File "cli2gui\application\application.py", line 51, in run
  File "cli2gui\gui\dearpygui_wrapper.py", line 154, in main
  File "dearpygui\dearpygui.py", line 4341, in add_font
SystemError: <built-in function add_font> returned a result with an exception set
[PYI-21340:ERROR] Failed to execute script 'gui' due to unhandled exception!

Description

Cli2Gui crashed at an add_font call

Expected Behavior

Cli2Gui should not crash

Actual Behavior

Explain what actually happened, including any error messages, crashes, or unexpected behavior. Screenshots are helpful if applicable.

System Information

Please provide the following additional information about your system or environment:

mokurin000 commented 1 month ago

I tried to run without pyinstaller, it works without any problem. Sorry for the invalid issue, I should add --collect-data The only thing Cli2Gui can do is to add hooks for pyinstaller