From 88cf8709cb7e156694b94c20206c21e5277671a1 Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Mon, 2 Mar 2020 16:26:31 +0100
Subject: [PATCH] PyUtils: More python 3 fixes

Work around pyroot issue with getting trailing garbage when accessing
a string stored in a tree.   This can confuse the bytes->unicode conversion
resulting in a crash.
---
 Tools/PyUtils/python/MetaReader.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py
index 135bca1645f..b685a46ba54 100644
--- a/Tools/PyUtils/python/MetaReader.py
+++ b/Tools/PyUtils/python/MetaReader.py
@@ -393,7 +393,11 @@ def _read_guid(filename):
 
     for i in range(params.GetEntries()):
         params.GetEntry(i)
-        param = params.db_string
+        # 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()
 
         result = regex.match(param)
         if result:
-- 
GitLab