Skip to content

Commit c32db43

Browse files
committed
working with unicode cli
1 parent 423e4e3 commit c32db43

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

vao-recorder.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,16 @@ def typer_warn(message: str):
8888

8989
def yaml_dump(data, to_file: Path = None) -> str:
9090
if to_file:
91-
with open(to_file, 'w') as f:
91+
with open(to_file, 'w', encoding="utf-8") as f:
9292
return yaml.dump(data, stream=f, allow_unicode=True)
9393
return yaml.dump(data, allow_unicode=True)
9494

9595

96+
def yaml_load(from_file: Path) -> dict:
97+
with open(from_file, 'r', encoding="utf-8") as f:
98+
return yaml.safe_load(f)
99+
100+
96101
# ------------------------------ Configuration ------------------------------ #
97102

98103

@@ -266,8 +271,7 @@ def config(
266271
def get_config(path=DEFAULT_CONFIG_PATH) -> dict:
267272
_config = None
268273
if path.exists():
269-
with open(path, 'r') as f:
270-
_config = yaml.safe_load(f)
274+
_config = yaml_load(path)
271275
if not _config:
272276
typer_warn(f"No configuration found in {path}. Generate one.")
273277
_config = config(path)

0 commit comments

Comments
 (0)