Skip to content

Commit 5b70f09

Browse files
create warning for non-string substitutions
1 parent 59e09a6 commit 5b70f09

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

schimpy/schism_yaml.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def substitute_env(env):
5656
while True:
5757
count_substitutions = 0
5858
for k, v in env.items():
59+
# Skip non-string values (e.g., integers, floats, bools)
60+
if not isinstance(v, str):
61+
warnings.warn(
62+
f"Skipping substitution for key '{k}' with non-string value: {v} (type: {type(v).__name__})"
63+
)
64+
continue
5965
template = string.Template(v)
6066
substituted = template.safe_substitute(**env)
6167
if v != substituted:

0 commit comments

Comments
 (0)