Skip to content

Allowing empty files in template directories #382

@lazlop

Description

@lazlop

Would it be possible to allow there to be empty files in template directories?
Currently, if I attempt to load a directory with any empty files, I get an error, as so:
File ~/Desktop/HPflex/Semantic_MPC_Interface/.venv/lib/python3.10/site-packages/buildingmotif/dataclasses/library.py:533, in Library._read_yml_file(self, file, template_id_lookup, dependency_cache) 531 """Read a YML file into this library. Utility function for_load_from_directory`."""
532 contents = yaml.load(open(file, "r"), Loader=yaml.FullLoader)
--> 533 for templ_name, templ_spec in contents.items():
534 # compile the template body using its rules
535 templ_spec = compile_template_spec(templ_spec)
536 # input name of template

AttributeError: 'NoneType' object has no attribute 'items'
`

This is not a high priority issue, but I am using template directories that have a convention of having certain file names, which results in some empty files occasionally

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions