PyROOT get TNamed via GetObject does not work in 6.22

Dear ROOT developers,

I am trying to read a TNamed from a ROOT file using PyROOT and ROOT 6.22. Following code worked with previous ROOT versions:

saveMeHere = TNamed()
rootFileObj.GetObject("nameOfTNamed", saveMeHere)

However, with 6.22, I get following error:

TypeError: Template method resolution failed:
  Failed to instantiate "GetObject(std::string,TNamed&)"
  Failed to instantiate "GetObject(std::string,TNamed*)"
  Failed to instantiate "GetObject(std::string,TNamed)"

I suppose this has to do with the move to cppyy. Do you know a way to solve this? Thank you in any case!


ROOT Version: 6.22
Platform: SLC7

Hi Ben,

This should work:

myTNamed = rootFileObj.nameOfTNamed

or, if the name of the object is not something that can be specified as a Python attribute, you can do:

myTNamed = rootFileObj.Get('nameOfTNamed')
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.