sanmusen214 / BAAH

A script that can automatically finish daily tasks in Blue Archive (global/Japan/CN/CN bilibili server). 碧蓝档案国际服/日服/蔚蓝档案国服/B服每日任务脚本
MIT License
377 stars 13 forks source link

UnicodeEncodeError: 'charmap' codec can't encode characters #65

Open somnaewq opened 1 month ago

somnaewq commented 1 month ago

When I press execute in 1.5.1 I get the following error, 1.4.11 still works for me

使用语言/Use language:  en_US
2024-07-11 13:52:45.2121084 [W:onnxruntime:Default, onnxruntime_pybind_state.cc:1983 onnxruntime::python::CreateInferencePybindStateModule] Init provider bridge failed.
{'OPEN_IN_WEB': True}
NiceGUI ready to go on http://localhost:8001
RUN
Traceback (most recent call last):
  File "main.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 419, in exec_module
  File "modules\utils\__init__.py", line 3, 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 419, in exec_module
  File "modules\utils\adb_utils.py", line 5, 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 419, in exec_module
  File "modules\utils\log_utils.py", line 86, in <module>
  File "modules\utils\log_utils.py", line 24, in __init__
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-3: character maps to <undefined>
Traceback (most recent call last):
  File "main.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 419, in exec_module
  File "modules\utils\__init__.py", line 3, 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 419, in exec_module
  File "modules\utils\adb_utils.py", line 5, 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 419, in exec_module
  File "modules\utils\log_utils.py", line 86, in <module>
  File "modules\utils\log_utils.py", line 24, in __init__
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-3: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 51, in <module>
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 21-27: character maps to <undefined>
[25200] Failed to execute script 'main' due to unhandled exception!
Process finished.
sanmusen214 commented 1 month ago

When I press execute in 1.5.1 I get the following error, 1.4.11 still works for me

I think this issue is caused by the character encoding when trying to log information in the GUI. Try to double click the BAAH.exe to open BAAH1.5.1 (and maybe need to input the target config file name) but not execute it in the GUI, does it work?

somnaewq commented 1 month ago

Yes, running directly from BAAH.exe works.

sanmusen214 commented 1 month ago

Yes, running directly from BAAH.exe works.

OK, I will add another button in GUI to run BAAH in a new terminal (just like before in 1.4.11).

sanmusen214 commented 1 month ago

You can download 1.5.2 and find "save and execute (terminal)” button in the gui. Please leave this issue open, I'm figuring on proper encoding method of running BAAH in GUI.