How to RNTupleModel.MakeField in python

Hi! I try to create (and fill) in python a RNTuple but it is not clear to me the python syntax to add a field ..
for the c++ syntax i have the error:

./json2rntuple.py
Traceback (most recent call last):
  File "/home/adrian/work-GRID/root_json/./json2rntuple.py", line 20, in <module>
    name       = model.MakeField<str>("name");
TypeError: '<' not supported between instances of '_RNTupleModel_MakeField' and 'type'

while not using the type specification yields:

./json2rntuple.py
Traceback (most recent call last):
  File "/home.hdd/adrian/work-GRID/root_json/./json2rntuple.py", line 20, in <module>
    name       = model.MakeField("name");
  File "/usr/lib64/python3.9/site-packages/ROOT/_pythonization/_rntuple.py", line 110, in __call__
    self._original_method(*args)
TypeError: Template method resolution failed:
  Failed to instantiate "MakeField(std::string)"

Thanks a lot!

I guess @jblomer can help you.

The template parameters are specified in brackets, like

model.MakeField["std::string"]("name")

Unfortunately, we don’t have Python tutorials yet. Meanwhile, you can use the tests as blueprint:

1 Like