I'm trying to load a multi-document YAML config file like the following:
file:
%YAML 1.2
---
num_epochs: 1
---
num_epochs: 1
and the python script is:
from ruamel.yaml import YAML
yaml = YAML(typ='unsafe')
configs = yaml.load_all(Path(Experiment.config_file))
for config in configs:
print(config)
when executed, it gives the following error:
ruamel.yaml.parser.ParserError: found incompatible YAML document
in "../MAML_tensorflow/experiment.yml", line 1, column 1
The file works if I use load_all
directly import from the module. Is this expected behavior?
This is likely a bug, because setting the implementation flag to pure
gives the correct parse result.
from ruamel.yaml import YAML
yaml = YAML(typ='unsafe', pure=True)
configs = yaml.load_all(Path(Experiment.config_file))
for config in configs:
print(config)
while this does not and gives the error above
from ruamel.yaml import YAML
yaml = YAML(typ='unsafe')
configs = yaml.load_all(Path(Experiment.config_file))
for config in configs:
print(config)