Just encountered some toolkit behavior that seems a bit short-sighted in its implementation:
tk.template_from_path(path)
due to some ambiguity in our templates it produces this error:
2 templates are matching the path ‘/proj/fsp/sequences/fs1/fb/fb0170/plates/publish/bg/0001/4324x2280/fs1_fb0170_bg_v0001.%d.exr’.
The overlapping templates are:
<Sgtk TemplatePath standalone_shot_publish: sequences/[{sg_shot_installment}/]{sg_shot_sequence}/{sg_shot}/{sg_step}/publish/{task_name}/{version}[/{width}x{height}]/{sg_shot_basename_prefix}{sg_shot}{task_name}[_{name}]_v{version}[.{seq_frame}].{ext}>
{‘sg_shot’: ‘fb0170’, ‘seq_frame’: ‘%d’, ‘ext’: ‘exr’, ‘sg_shot_installment’: ‘fs1’, ‘sg_shot_sequence’: ‘fb’, ‘width’: 4324, ‘sg_shot_basename_prefix’: ‘fs1’, ‘version’: 1, ‘task_name’: ‘bg’, ‘sg_step’: ‘plates’, ‘height’: 2280}
<Sgtk TemplatePath plate_shot_publish: sequences/[{sg_shot_installment}/]{sg_shot_sequence}/{sg_shot}/{sg_step}/publish/{name}/{version}[/{width}x{height}]/{Installment}{sg_shot}{name}_v{version}[.{seq_frame}].{ext}>
{‘sg_shot’: ‘fb0170’, ‘name’: ‘bg’, ‘Installment’: ‘fs1’, ‘sg_shot_installment’: ‘fs1’, ‘sg_shot_sequence’: ‘fb’, ‘width’: 4324, ‘ext’: ‘exr’, ‘version’: 1, ‘seq_frame’: ‘%d’, ‘sg_step’: ‘plates’, ‘height’: 2280}
It appears the method refuses to accommodate the ambiguity and return multiple templates. Instead I’m reduced to wrapping this call in a try/except and parsing the error message for a list of candidate templates. Surely there’s a better way that doesn’t require me rewriting tk.template_from_path()?