AttributeError: DataResult has no attribute values

When trying to create a PlotlyAndDataView I get the next error:

2022-08-08 16:21:58.001 ERROR : Exception is raised
Traceback (most recent call last):
File “viktor_connector\connector.pyx”, line 396, in connector.Job.execute
File “viktor\core.pyx”, line 1791, in viktor.core._handle_job
File “viktor\views.pyx”, line 1877, in viktor.views.View._wrapper
File “C:\Users\wbron\viktor-apps\wsp-remmingwerken\app\lead_in_structure\controller.py”, line 95, in visualize_scia_results_iterative_calculation
return PlotlyAndDataResult(plotly_figure.to_json(), data_result)
File “viktor\views.pyx”, line 1636, in viktor.views.PlotlyAndDataResult.init
File “viktor\views.pyx”, line 921, in viktor.views._DataSubResult.init
File “viktor\views.pyx”, line 938, in viktor.views._DataSubResult._get_maximum_data_depth
AttributeError: ‘DataResult’ object has no attribute ‘values’

What is going wrong?

codesnippet:


def create_data_view_of_stress(xml_input: File) -> DataResult


    data = DataGroup(value_piles=DataItem("Piles", piles_df["s_E"].max()))

    return DataResult(data)


@PlotlyAndDataView("SCIA results Energy Equilibrium", duration_guess=5)
  def visualize_scia_results_iterative_calculation(self, params, entity_id, **kwargs):

      data_result = create_data_view_of_stress(xml_results)
      plotly_figure = create_plotly_iterative_energy_calculation_results(scia_model, results, params)

      return PlotlyAndDataResult(plotly_figure.to_json(), data_result)

Your create_data_view_of_stress function returns a DataResult instead of the DataGroup. PlotlyAndDataResult expects a DataGroup as 2nd argument.

1 Like