-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Running the following snippet:
cfg = mkidreadout.config.load('/path/to/roach.yml')
cfg.save('test.yml')
produces the following output when run using ruamel.yaml = 0.16.0
/home/neelay/MKIDCore/mkidcore/config.pyc in save(self, file)
372 with self._lock:
373 with open(file, 'w') as f:
--> 374 yaml.dump(self, f)
375
376 def registerfromconfigparser(self, cp, namespace=None):/home/neelay/anaconda2/envs/readout/lib/python2.7/site-packages/ruamel/yaml/main.pyc in dump(self, data, stream, _kw, transform)
433 return self.dump_all([data], stream, _kw, transform=transform)
434
--> 435 def dump_all(self, documents, stream, _kw=enforce, transform=None):
436 # type: (Any, Union[Path, StreamType], Any, Any) -> Any
437 if self._context_manager:/home/neelay/anaconda2/envs/readout/lib/python2.7/site-packages/ruamel/yaml/main.pyc in dump(self, data)
799 # # set the constructor and parser on YAML() instance
800 # self._yaml.get_constructor_parser(stream)
--> 801 #
802 # def load(self):
803 # if not self._input_inited:/home/neelay/anaconda2/envs/readout/lib/python2.7/site-packages/ruamel/yaml/representer.pyc in represent(self, data)
82 self.represented_objects = {} # type: Dict[Any, Any]
83 self.object_keeper = [] # type: List[Any]
---> 84 self.alias_key = None
85
86 def represent_data(self, data):/home/neelay/anaconda2/envs/readout/lib/python2.7/site-packages/ruamel/yaml/representer.pyc in represent_data(self, data)
90 else:
91 self.alias_key = id(data)
---> 92 if self.alias_key is not None:
93 if self.alias_key in self.represented_objects:
94 node = self.represented_objects[self.alias_key]/home/neelay/anaconda2/envs/readout/lib/python2.7/site-packages/ruamel/yaml/representer.pyc in ignore_aliases(self, data)
675 if PY2 and not isinstance(data, unicode):
676 data = unicode(data, 'ascii')
--> 677 tag = u'tag:yaml.org,2002:str'
678 return self.represent_scalar(tag, data, style=style)
679/home/neelay/MKIDCore/mkidcore/config.pyc in getattr(self, key)
163 with self._lock:
164 k1, _, krest = key.partition('.')
--> 165 return self[k1][krest] if krest else self[k1]
166
167 def setattr(self, key, value):KeyError: 'anchor'`
Downgrading ruamel.yaml to 0.15.64 fixes the issue. I'll update the condaenv to specify this version for now.