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
- Run
set_simulation_params.py to populate simulation properties
- Run
tangos serve
- 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
Description
The script that stores simulation parameters (
paramfile_keysandparamfile_vals) causes thetangos serveweb interface to crash when loading the simulation list view.Background
The
set_simulation_params.pyscript stores parameter file data:Problem
When
tangos serveis run and the root URL is accessed, the web interface attempts to display all simulation properties in a table. Thedata_repr()method intangos/core/simulation.pyis called to generate a string representation of each property value. However, this method does not handlelisttypes—it falls through to anelsebranch that assumes the value is an integer and attempts to format it with%d, which fails.Steps to Reproduce
set_simulation_params.pyto populate simulation propertiestangos servehttp://127.0.0.1:6543/in a browserError Output