load_scene#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
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(path)[source]#
Read and validate a multi-panel document from disk.
- Parameters:
path (
Path) – A*.scene.yamlfile. A single-panel document also works and comes back as one entry namedpanel.- Return type:
- Returns:
Panel name to scene graph, in declaration order – which is reading order.
- 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
Pages are not read:
load_scene_documentkeeps them.Example
>>> from pathlib import Path >>> from tempfile import TemporaryDirectory >>> from scenet import load_scene >>> with TemporaryDirectory() as folder: ... path = Path(folder) / "two.scene.yaml" ... _ = path.write_text( ... "cast: {a: {reference: alice}}\npanels: {one: {}, two: {}}", encoding="utf-8" ... ) ... panels = load_scene(path) >>> list(panels) ['one', 'two']
See also
parse_scene, for text.