From b24ad5465d0722426855c6905a7e7c6ef1c834e7 Mon Sep 17 00:00:00 2001 From: Marcin Nowak <Marcin.Nowak@cern.ch> Date: Wed, 26 Feb 2020 15:45:15 +0100 Subject: [PATCH 1/2] Fix for broken File GUID reading in MetaReader --- Tools/PyUtils/python/MetaReader.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py index 12a4f54c9802..e143c4337c28 100644 --- a/Tools/PyUtils/python/MetaReader.py +++ b/Tools/PyUtils/python/MetaReader.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import absolute_import import os @@ -391,11 +391,8 @@ def _read_guid(filename): regex = re.compile(r'^\[NAME=([a-zA-Z0-9_]+)\]\[VALUE=(.*)\]') for i in range(params.GetEntries()): - # Work around apparent pyroot issue: - # If we try to access params.db_string directly, we see trailing - # garbage, which can confuse python's bytes->utf8 conversion - # and result in an error. - param = params.GetLeaf('db_string').GetValueString() + params.GetEntry(i) + param = params.db_string result = regex.match(param) if result: -- GitLab From 90cde1c893d3d46165e063709c3f32050fea54c3 Mon Sep 17 00:00:00 2001 From: Marcin Nowak <Marcin.Nowak@cern.ch> Date: Wed, 26 Feb 2020 17:21:26 +0100 Subject: [PATCH 2/2] Return the last FID from ##Params, not the first --- Tools/PyUtils/python/MetaReader.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py index e143c4337c28..135bca1645f4 100644 --- a/Tools/PyUtils/python/MetaReader.py +++ b/Tools/PyUtils/python/MetaReader.py @@ -389,6 +389,7 @@ def _read_guid(filename): params = root_file.Get('##Params') regex = re.compile(r'^\[NAME=([a-zA-Z0-9_]+)\]\[VALUE=(.*)\]') + fid = None for i in range(params.GetEntries()): params.GetEntry(i) @@ -396,13 +397,11 @@ def _read_guid(filename): result = regex.match(param) if result: - name = result.group(1) - value = result.group(2) + if result.group(1) == 'FID' : + # don't exit yet, it's the last FID entry that counts + fid = result.group(2) - if name == 'FID': - return value - - return None + return fid def _extract_fields(obj): -- GitLab