Skip to content

Commit

Permalink
Merge pull request #21 from Zhou-Shilin/18-not-working
Browse files Browse the repository at this point in the history
Fix: Encoding issue when using EXE edition
  • Loading branch information
Zhou-Shilin authored Jun 6, 2024
2 parents 9dcd86b + 830477d commit d696189
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Linux Builds

on:
push:
branches:
- main
release:
types:
- created
Expand All @@ -26,6 +24,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set locale encoding to UTF-8
run: |
python -c "import locale; locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')"
- name: Build project
run: python setup.py build

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Windows Builds

on:
push:
branches:
- main
release:
types:
- created
Expand All @@ -26,6 +24,10 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set locale encoding to UTF-8
run: |
python -c "import locale; locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')"
- name: Build project
run: python setup.py build

Expand Down
2 changes: 2 additions & 0 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import mcschematic
import sys
import json
import locale

from log_writer import logger
import config
Expand All @@ -18,6 +19,7 @@ def initialize():
Returns:
None
"""
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
logger(f"Launch. Software version {config.VERSION_NUMBER}, platform {sys.platform}")

def askgpt(system_prompt: str, user_prompt: str, model_name: str, disable_json_mode: bool = False, image_url: str = None):
Expand Down
2 changes: 1 addition & 1 deletion log_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def logger(text: str):

os.makedirs(os.path.dirname(log_filename), exist_ok=True)

with open(log_filename + ".log", "a") as log_file:
with open(log_filename + ".log", "a", encoding='utf-8') as log_file:
log_file.write(log_line)
3 changes: 3 additions & 0 deletions ui-v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def open_config(args: dict):
tab_names=["Generate", "Render", "Settings"]
)

# Initialize Core
core.initialize()

# Banner
root.add_banner_tool(GitHub("https://github.com/CubeGPT/BuilderGPT"))

Expand Down

0 comments on commit d696189

Please sign in to comment.