Add check for invalid kwargs

This commit is contained in:
McCloudS
2024-08-03 11:35:12 -06:00
committed by GitHub
parent c1d2e0d874
commit bdd5fd23a7

View File

@@ -104,7 +104,11 @@ def update_env_variables():
custom_regroup = os.getenv('CUSTOM_REGROUP', 'cm_sl=84_sl=42++++++1')
detect_language_length = os.getenv('DETECT_LANGUAGE_LENGTH', 30)
skipifexternalsub = convert_to_bool(os.getenv('SKIPIFEXTERNALSUB', False))
kwargs = ast.literal_eval(os.getenv('SUBGEN_KWARGS', '{}') or '{}')
try:
kwargs = ast.literal_eval(os.getenv('SUBGEN_KWARGS', '{}') or '{}')
except ValueError:
kwargs = {}
logging.info("kwargs (SUBGEN_KWARGS) is an invalid dictionary, defaulting to empty '{}'")
set_env_variables('subgen.env')