load_scene_document#
Import |
|
Defined in |
|
Install |
|
Since |
0.10 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.frontends.yaml_front.load_scene_document(path)[source]#
Read a scene and the pages it is laid out on, from disk.
- Parameters:
path (
Path) – A*.scene.yamlfile, or any YAML document the frontend reads.- Return type:
- Returns:
The panels and the layout.
- Raises:
FileReadError – The file cannot be read: a
MissingFileError, also aFileNotFoundError, when it is not there.PanelSyntaxError – The document is malformed, invalid, or not UTF-8.
CompositionError – An
over:names a panel that does not exist, or the chain is a cycle.
Note
Nothing is laid out; the pages are validated against the panels only.
Example
>>> from pathlib import Path >>> from tempfile import TemporaryDirectory >>> from scenet import load_scene_document >>> with TemporaryDirectory() as folder: ... path = Path(folder) / "page.scene.yaml" ... _ = path.write_text( ... "cast: {a: {reference: alice}}\n" ... "panels: {one: {}}\npages: [{tiers: [{panels: [one]}]}]", ... encoding="utf-8", ... ) ... document = load_scene_document(path) >>> len(document.layout.pages) 1
See also
parse_scene_document, for text.