# Buggy code
def _template_url_to_path(self, template_url):
    # TODO: this code assumes a specific url schema, should rather attempt to
    #  resolve values from params/defaults
    if isinstance(template_url, dict):
        if "Fn::Sub" in template_url.keys():
            if isinstance(template_url["Fn::Sub"], str):
                template_path = template_url["Fn::Sub"].split("}")[-1]
            else:
                template_path = template_url["Fn::Sub"][0].split("}")[-1]
        elif "Fn::Join" in list(template_url.keys())[0]:
            template_path = template_url["Fn::Join"][1][-1]
    elif isinstance(template_url, str):
        template_path = "/".join(template_url.split("/")[-2:])
    template_path = self.project_root / template_path
    if template_path.is_file():
        return template_path
    LOG.warning(
        "Failed to discover path for %s, path %s does not exist",
        template_url,
        template_path,
    )
    return ""


# Traceback (TypeError)
version 0.9.8
[ERROR  ] : TypeError expected str, bytes or os.PathLike object, not dict_node
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/taskcat/_cli.py", line 70, in main
cli.run()
File "/usr/local/lib/python3.7/site-packages/taskcat/_cli_core.py", line 228, in run
return getattr(command(), subcommand)(**args)
File "/usr/local/lib/python3.7/site-packages/taskcat/_cli_modules/test.py", line 60, in run
templates = config.get_templates(project_root_path)
File "/usr/local/lib/python3.7/site-packages/taskcat/_config.py", line 312, in get_templates
s3_key_prefix=f"{self.config.project.name}/",
File "/usr/local/lib/python3.7/site-packages/taskcat/_cfn/template.py", line 30, in __init__
self._find_children()
File "/usr/local/lib/python3.7/site-packages/taskcat/_cfn/template.py", line 111, in _find_children
resource["Properties"]["TemplateURL"]
File "/usr/local/lib/python3.7/site-packages/taskcat/_cfn/template.py", line 72, in _template_url_to_path
template_path = self.project_root / template_path
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 908, in __truediv__
return self._make_child((key,))
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 695, in _make_child
drv, root, parts = self._parse_args(args)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 649, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not dict_node

# Fixed code
def _template_url_to_path(self, template_url):
    # TODO: this code assumes a specific url schema, should rather attempt to
    #  resolve values from params/defaults
    template_path = None
    if isinstance(template_url, dict):
        if "Fn::Sub" in template_url.keys():
            if isinstance(template_url["Fn::Sub"], str):
                template_path = template_url["Fn::Sub"].split("}")[-1]
            else:
                template_path = template_url["Fn::Sub"][0].split("}")[-1]
        elif "Fn::Join" in list(template_url.keys())[0]:
            template_path = template_url["Fn::Join"][1][-1]
    elif isinstance(template_url, str):
        template_path = "/".join(template_url.split("/")[-2:])
    if isinstance(template_path, str):
        template_path = self.project_root / template_path
        if template_path.is_file():
            return template_path
    LOG.warning(
        "Failed to discover path for %s, path %s does not exist",
        template_url,
        template_path,
    )
    return ""