-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
In a recent PR for linkml-runtime. I encountered the following error in unflatten_from_csv.
objs = []
for row in r:
nu_obj = {}
for k, v in row.items():
key_config = config.key_configs.get(k, None)
> v = v.replace('\\n', '\n').replace('\\t', '\t')
^^^^^^^^^
E AttributeError: 'list' object has no attribute 'replace'
.venv/lib/python3.12/site-packages/json_flattener/flattener.py:355: AttributeError
----------------------------------------------------------- Captured log call ------------------------------------------------------------
WARNING linkml_runtime.utils.csvutils:csvutils.py:37 Index slot or schema not specified
======================================================== short test summary info =========================================================
FAILED tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py::CsvAndTsvGenTestCase::test_table_model - AttributeError: 'list' object has no attribute 'replace'
It appears that our upstream processes can now pass a list object into this function where v.replace() get's called. At minimum, we should guard against the list call here but we may need to do something more intelligent if lists are passed, such as iterating through them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels