Attachment¶
- class audformat.Attachment(path, *, description=None, meta=None)[source]¶
Database attachment.
Adds a file or folder as attachment to a database. If a folder is provided, all of its sub-folders and files are included.
- Parameters
- Raises
ValueError – if
path
is absolute or contains\
,..
or.
RuntimeError – when assigning an attachment to a database, but the database contains another attachment with an path that is identical or nested compared to the current attachment path
Examples
>>> Attachment("file.txt", description="Attached file") {description: Attached file, path: file.txt}
dump()¶
files¶
- Attachment.files¶
List all files that are part of the attachment.
List recursively the relative path of all files that exist under
audformat.Attachment.path
on hard disk.- Raises
FileNotFoundError – if a path associated with the attachment cannot be found
RuntimeError – if a path associated with the attachment is a symlink
RuntimeError – if attachment is not part of a database
RuntimeError – if database is not saved to disk