Reading TTree TypeDef Error on root-5.34.25

I’m having similar issues as in [root.cern.ch/phpBB3/viewtopic.p … ror#p79227](Reading Tree in PyROOT but can’t resolve them. I’m trying to loop over a TTree with

for clus in tree:
    print clus.prob1P

and getting “TypeError: attempt to bind ROOT object w/o class”. I’m running ROOT 5.34.25 and python 2.7.5, I’ve set the environment variables
$LD_LIBRARY_PATH: /Users/edvinsidebo/root53425/lib:/System/Library/Frameworks/Python.framework/Versions/Current/lib
and
$PYTHONDIR: /System/Library/Frameworks/Python.framework/Versions/Current

EDIT: It seems this might have to do with the file and not something wrong with my pyROOT - looping like above works fine on a different file. Anyone have an idea of what might be causing this?

Hi,

there can be legitimate reasons for that error. :slight_smile: The link you post is indeed to a bug, but that should be all well and gone in .25. If there is, however, really no dictionary available for the class, then this error is the correct message.

Any chance of setting up a small reproducer?

Cheers,
Wim

Oh, I thought that should always work, I’m completely new to PyROOT so I don’t know how it works. Which class do you mean exactly, I thought only TTrees and whatever is in the leaves (here ints) are involved here? What’s actually happening when you’re doing that for loop, in what way does it differ from doing a standard loop over tree entries in ROOT?

I attach my small python script along with the root file with the tree. In case needed I attach also the code used to produce the root file (which however might be difficult to get anything out of, as it depends on other files etc.).
plot_test.py (174 Bytes)
FullValidation.cxx (18 KB)
allNNoutputs_1000clusters.root (1.93 MB)

Hi,

indeed, that does not sound right. Looking at the code, the issue is the naming, so this will work: for clus in tree: print clus.b_prob1PI’ll have a look later to see why the first name, w/o the ‘b_’, can not be found instead.

Cheers,
Wim