cldf / csvw

CSV on the web
Apache License 2.0
37 stars 6 forks source link

TableGroup.from_value breaks `segments` library #62

Closed LinguList closed 2 years ago

LinguList commented 2 years ago

For the lexibank workflow, I receive errors now when it comes to loading orthography profiles. The problem seems to be that we can no longer load a CSV file without the JSON metadata (?).

I tested this on lexibank/davletshinaztecan, where I receive the following error:

  File "XXX/segments/src/segments/profile.py", line 108, in from_file
    tg = TableGroup.fromvalue(cls.MD)
  File "XXX/csvw/src/csvw/metadata.py", line 430, in fromvalue
    return cls(**cls.partition_properties(d))
  File "<attrs generated init csvw.metadata.TableGroup>", line 39, in __init__
  File "XXX/csvw/src/csvw/metadata.py", line 1402, in converter_tables
    res.append(Table.fromvalue(vv) if isinstance(vv, dict) else vv)
  File "XXX/csvw/src/csvw/metadata.py", line 430, in fromvalue
    return cls(**cls.partition_properties(d))
  File "<attrs generated init csvw.metadata.Table>", line 46, in __init__
  File "XXX/csvw/src/csvw/metadata.py", line 1166, in __attrs_post_init__
    raise ValueError('url property is required for Tables')

This is the except statement in segments, where segments first tries to read the profile with metadata in JSON and then reads it from the default metadata. This fails now, while it worked before.

xrotwang commented 2 years ago

Fixed in segments.