From e9fba3947c5690d869a163f5ab631213b26ee63b Mon Sep 17 00:00:00 2001 From: Chaoses-Ib Date: Sat, 15 Jun 2024 00:03:18 +0800 Subject: [PATCH] fix(transpile): read workflow file in UTF-8 encoding (#42) --- src/comfy_script/transpile/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/comfy_script/transpile/__main__.py b/src/comfy_script/transpile/__main__.py index 7880c16..fd51425 100644 --- a/src/comfy_script/transpile/__main__.py +++ b/src/comfy_script/transpile/__main__.py @@ -1,12 +1,13 @@ +from typing import TextIO import click from . import * @click.command(help='Transpile workflow to ComfyScript.') -@click.argument('workflow', type=click.File('r')) +@click.argument('workflow', type=click.File('r', encoding='utf-8')) @click.option('--api', type=click.STRING, default='http://127.0.0.1:8188/', show_default=True) @click.option('--runtime', is_flag=True, default=False, show_default=True, help='Wrap the script with runtime imports and workflow context.') -def cli(workflow, api: str, runtime: bool): +def cli(workflow: TextIO, api: str, runtime: bool): workflow = workflow.read() script = WorkflowToScriptTranspiler(workflow, api).to_script(runtime=runtime) print(script)