hello there, hope you are doing great! :kedroid: ...
# questions
hello there, hope you are doing great! kedroid Issue: I'm trying to persist a dict as a yaml file. The related catalog entry is the following:
Copy code
  type: yaml.YAMLDataSet
  filepath: data/test/05_model_input/optimisation_programme.yaml
  layer: model_input
However, it fails with the following error:
Copy code
DataSetError: Failed while saving data to data set YAMLDataSet(filepath=/Users/cyril_verluise/Documents/GitHub/ClimaTeX/dist/apps/alhambra/rendered/alhambra/data/test/05_model_input/optimisation_programme.yaml, protocol=file, 
save_args={'default_flow_style': False}).
'str' object has no attribute '__name__'
Expected behaviour From the doc, I understood that the save function was just a wrapper around yaml.dump which should work with my `optimisation_programme`(dict) kedro version
Any idea?
Copy code
/Users/cyril_verluise/opt/anaconda3/envs/climatex/lib/python3.8/site-packages/yaml/representer.p │
│ y:331 in represent_object                                                                        │
│                                                                                                  │
│   328 │   │   │   listitems = list(listitems)                                                    │
│   329 │   │   if dictitems is not None:                                                          │
│   330 │   │   │   dictitems = dict(dictitems)                                                    │
│ ❱ 331 │   │   if function.__name__ == '__newobj__':                                              │
│   332 │   │   │   function = args[0]                                                             │
│   333 │   │   │   args = args[1:]                                                                │
│   334 │   │   │   tag = 'tag:<http://yaml.org|yaml.org>,2002:python/object/new:'                                   │
AttributeError: 'str' object has no attribute '__name__'

The above exception was the direct cause of the following exception:
direct cause of the error above ☝️
that’s a new one for me
it’s also odd that’s in in the
are you saving any complex objects? Any fancy numpy stuff that may look like something primitive when it’s not?
nope, nothing fancy.
let me check that yaml dump works properly on the same input
it’s the world’s simplest implementation behind the scenes
just wrapped around the fsspec abstraction
indeed, you are right. my dict has some fancy stuff in it and yaml is the source of the error. My bad. completely forgot about that
no worries - that’s a nasty stacktrace
been there!
thanks a lot!
Quick follow up, there is a simple workaround which consists in building a custom kedro dataset using
save and load methods. Limitation: then the source dict and the reloaded dict are the same iff the source dict did not contain any fancy stuff (which is the reason why we want to use omegaconf)