From c0e57e0e396e04cde40658e0f6ba2bf2fced0bd8 Mon Sep 17 00:00:00 2001 From: binary-husky <505030475@qq.com> Date: Sun, 14 May 2023 15:18:33 +0800 Subject: [PATCH] fix bool env read bug --- toolbox.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/toolbox.py b/toolbox.py index bdd99c9fb2..6f5469e817 100644 --- a/toolbox.py +++ b/toolbox.py @@ -545,7 +545,10 @@ def read_env_variable(arg, default_value): print(f"[ENV_VAR] 尝试加载{arg},默认值:{default_value} --> 修正值:{env_arg}") try: if isinstance(default_value, bool): - r = bool(env_arg) + env_arg = env_arg.strip() + if env_arg == 'True': r = True + elif env_arg == 'False': r = False + else: print('enter True or False, but have:', env_arg); r = default_value elif isinstance(default_value, int): r = int(env_arg) elif isinstance(default_value, float):