jams.load
- jams.load(path_or_file, validate=True, strict=True, fmt='auto')[source]
Load a JAMS Annotation from a file.
- Parameters:
- path_or_filestr or file-like
Path to the JAMS file to load OR An open file handle to load from.
- validatebool
Attempt to validate the JAMS object
- strictbool
if validate == True, enforce strict schema validation
- fmtstr [‘auto’, ‘jams’, ‘jamz’]
The encoding format of the input
If auto, encoding is inferred from the file name.
If the input is an open file handle,
jamsencoding is used.
- Returns:
- jamJAMS
The loaded JAMS object
- Raises:
- SchemaError
if validate == True, strict==True, and validation fails
See also
Examples
>>> # Load a jams object from a file name >>> J = jams.load('data.jams') >>> # Or from an open file descriptor >>> with open('data.jams', 'r') as fdesc: ... J = jams.load(fdesc) >>> # Non-strict validation >>> J = jams.load('data.jams', strict=False) >>> # No validation at all >>> J = jams.load('data.jams', validate=False)