From 3161612d22bd382e4bf46cca2ce5c5bbecebb3a3 Mon Sep 17 00:00:00 2001 From: ywkao Date: Tue, 3 Dec 2024 14:29:39 +0100 Subject: [PATCH] Fix TypeError in `DQMServices/Demo/test/dqmiodumpentries.py`. Omit DeprecationWarning 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 --- DQMServices/Demo/test/dqmiodumpentries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQMServices/Demo/test/dqmiodumpentries.py b/DQMServices/Demo/test/dqmiodumpentries.py index 2bdfa3a410c53..7e6fec0511f58 100755 --- a/DQMServices/Demo/test/dqmiodumpentries.py +++ b/DQMServices/Demo/test/dqmiodumpentries.py @@ -30,7 +30,7 @@ } f = ROOT.TFile.Open(args.inputfile) -idxtree = f["Indices"] +idxtree = getattr(f, "Indices") summary = defaultdict(lambda: 0) @@ -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)