atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
10 stars 4 forks source link

Dictionary changed size error #554

Closed sirex closed 5 months ago

sirex commented 6 months ago

When I do:

http get https://get-test.data.gov.lt/datasets/gov/ivpk/adp/catalog/Dataset Accept:text/html

I get:

HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=utf-8

<h1>RuntimeError</h1>
<p>dictionary changed size during iteration</p>

This error appears only for html format.

Server logs show:

Traceback (most recent call last):
  File "spinta/api.py", line 269, in homepage
    return await create_http_response(context, params, request)
  File "spinta/utils/response.py", line 166, in create_http_response
    return await commands.getall(
  File "spinta/commands/read.py", line 146, in getall
    return render(context, request, model, params, rows, action=action)
  File "spinta/renderer.py", line 23, in render
    return commands.render(
  File "spinta/formats/html/commands.py", line 144, in render
    return _render_model(context, request, model, action, params, data, headers)
  File "spinta/formats/html/commands.py", line 248, in _render_model
    ctx = build_template_context(
  File "spinta/formats/html/commands.py", line 222, in build_template_context
    rows, empty = _is_empty(rows)
  File "spinta/formats/html/commands.py", line 176, in _is_empty
    row = next(rows)
  File "spinta/utils/nestedstruct.py", line 15, in flatten
    for v in vals:
  File "spinta/accesslog/__init__.py", line 162, in log_response
    for row in rows:
  File "spinta/commands/read.py", line 132, in <genexpr>
    commands.prepare_data_for_response(
  File "spinta/formats/html/commands.py", line 310, in prepare_data_for_response
    data = {
  File "spinta/formats/html/commands.py", line 311, in <dictcomp>
    prop.name: commands.prepare_dtype_for_response(
  File "spinta/formats/html/commands.py", line 569, in prepare_dtype_for_response
    for prop, val, sel in select_props(
  File "spinta/backends/helpers.py", line 156, in select_props
    for key, val, sel in select_keys(keys, value, select, reserved=reserved):
  File "spinta/backends/helpers.py", line 204, in select_keys
    for key, sel in select_only_keys(keys, select, reserved=reserved):
  File "spinta/backends/helpers.py", line 227, in select_only_keys
    for key in keys:
RuntimeError: dictionary changed size during iteration

Struktūros aprašas:

https://github.com/atviriduomenys/manifest/blob/master/datasets/gov/ivpk/adk.csv