Skip to content

Storing parameter file data as lists causes tangos web server crash #26

@Bvogel4

Description

@Bvogel4

Description

The script that stores simulation parameters (paramfile_keys and paramfile_vals) causes the tangos serve web interface to crash when loading the simulation list view.

Background

The set_simulation_params.py script stores parameter file data:

# The default Tangos ORM doesn't support dictionaries here, so we will 
# just store keys and values as two lists
sim['paramfile_keys'] = list(pdict.keys())
sim['paramfile_vals'] = [pdict[key] for key in sim['paramfile_keys']]

Problem

When tangos serve is run and the root URL is accessed, the web interface attempts to display all simulation properties in a table. The data_repr() method in tangos/core/simulation.py is called to generate a string representation of each property value. However, this method does not handle list types—it falls through to an else branch that assumes the value is an integer and attempts to format it with %d, which fails.

Steps to Reproduce

  1. Run set_simulation_params.py to populate simulation properties
  2. Run tangos serve
  3. Navigate to http://127.0.0.1:6543/ in a browser

Error Output

2026-01-27 18:29:38,772 ERROR [waitress:437][waitress-0] Exception while serving /
Traceback (most recent call last):
  ...
  File "/home/Bvogel4/miniconda3/envs/public_data_1/lib/python3.12/site-packages/tangos/web/views/simulation_list.py", line 27, in simulation_list
    s[1 + ids.index(q.name_id)] = q.data_repr()
                                  ^^^^^^^^^^^^^
  File "/home/Bvogel4/miniconda3/envs/public_data_1/lib/python3.12/site-packages/tangos/core/simulation.py", line 160, in data_repr
    x = "%d" % f
        ~~~~~^~~
TypeError: %d format: a real number is required, not list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions