diff --git a/src/dynamicprompts/parser/parse.py b/src/dynamicprompts/parser/parse.py index 56cacfe..51bce52 100644 --- a/src/dynamicprompts/parser/parse.py +++ b/src/dynamicprompts/parser/parse.py @@ -440,9 +440,7 @@ def create_parser( # stripped with variable access. This restores them so that the # variable can be properly recognized at a later stage variable_ref.set_parse_action( - lambda s, l, t: parser_config.variable_start - + "".join(t) - + parser_config.variable_end, + lambda string, location, token: f"{parser_config.variable_start}{''.join(token)}{parser_config.variable_end}", ) variable_assignment = _configure_variable_assignment( diff --git a/src/dynamicprompts/samplers/utils.py b/src/dynamicprompts/samplers/utils.py index 34b4d0e..7171dbf 100644 --- a/src/dynamicprompts/samplers/utils.py +++ b/src/dynamicprompts/samplers/utils.py @@ -89,8 +89,8 @@ def replace_wildcard_variables( try: wildcard_result = wildcard.parse_string(command.wildcard) return command.with_content("".join(wildcard_result)) - except Exception as ex: - logger.warning("Unable to parse wildcard path %s", command.wildcard) + except Exception: + logger.warning("Unable to parse wildcard %r", command.wildcard, exc_info=True) return command @@ -114,4 +114,6 @@ def _replace_variable(string, location, token, *, variables: dict): if isinstance(variable, LiteralCommand): variable = variable.literal + if not isinstance(variable, str): + raise NotImplementedError("evaluating complex commands within wildcards is not supported right now") return variable or default or var_name