Spaces:
Runtime error
Runtime error
fix bool env read bug
Browse files- toolbox.py +4 -1
toolbox.py
CHANGED
@@ -545,7 +545,10 @@ def read_env_variable(arg, default_value):
|
|
545 |
print(f"[ENV_VAR] 尝试加载{arg},默认值:{default_value} --> 修正值:{env_arg}")
|
546 |
try:
|
547 |
if isinstance(default_value, bool):
|
548 |
-
|
|
|
|
|
|
|
549 |
elif isinstance(default_value, int):
|
550 |
r = int(env_arg)
|
551 |
elif isinstance(default_value, float):
|
|
|
545 |
print(f"[ENV_VAR] 尝试加载{arg},默认值:{default_value} --> 修正值:{env_arg}")
|
546 |
try:
|
547 |
if isinstance(default_value, bool):
|
548 |
+
env_arg = env_arg.strip()
|
549 |
+
if env_arg == 'True': r = True
|
550 |
+
elif env_arg == 'False': r = False
|
551 |
+
else: print('enter True or False, but have:', env_arg); r = default_value
|
552 |
elif isinstance(default_value, int):
|
553 |
r = int(env_arg)
|
554 |
elif isinstance(default_value, float):
|