Skip to content

Commit

Permalink
Fix TypeError in DQMServices/Demo/test/dqmiodumpentries.py. Omit De…
Browse files Browse the repository at this point in the history
…precationWarning of `getattr()`.

| ROOT version | `getattr(f,"x")` | `f["x"]`    |
| ------------ | ---------------- | ----------- |
| v6.30        | works            | Not working |
| v6.35        | works*           | works       |
| v6.32        | works*           | works       |

* This will display deprecation warning message
  • Loading branch information
ywkao committed Jan 7, 2025
1 parent 131d1e7 commit 3161612
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DQMServices/Demo/test/dqmiodumpentries.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

f = ROOT.TFile.Open(args.inputfile)
idxtree = f["Indices"]
idxtree = getattr(f, "Indices")

summary = defaultdict(lambda: 0)

Expand All @@ -42,7 +42,7 @@

# inclusive range -- for 0 entries, row is left out
firstidx, lastidx = idxtree.FirstIndex, idxtree.LastIndex
metree = f[treenames[metype]]
metree = getattr(f, treenames[metype])
# this GetEntry is only to make sure the TTree is initialized correctly
metree.GetEntry(0)
metree.SetBranchStatus("*",0)
Expand Down

0 comments on commit 3161612

Please sign in to comment.