jams.load(path_or_file, validate=True, strict=True, fmt='auto')[source]

Load a JAMS Annotation from a file.

path_or_file : str or file-like

Path to the JAMS file to load OR An open file handle to load from.

validate : bool

Attempt to validate the JAMS object

strict : bool

if validate == True, enforce strict schema validation

fmt : str [‘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, jams encoding is used.

jam : JAMS

The loaded JAMS object


if validate == True, strict==True, and validation fails


>>> # 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)