From 31885c7da227418f0f9dc5c4f55daba5fd04a7c0 Mon Sep 17 00:00:00 2001 From: Brennan Ashton <bashton@brennanashton.com> Date: Sun, 18 Nov 2018 07:35:05 -0800 Subject: grc: Silence import warnings caused by hier blocks on namespace renewal We do not have a good way right now to determine if an import is for a hier block, these imports will fail as they are not in the search path this is ok behavior, unfortunately we could be hiding other import bugs. Fixes #2183 --- grc/core/FlowGraph.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'grc/core/FlowGraph.py') diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index a47513d314..2c3d6f26c7 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -191,8 +191,13 @@ class FlowGraph(Element): for expr in self.imports(): try: exec(expr, namespace) + except ImportError: + # We do not have a good way right now to determine if an import is for a + # hier block, these imports will fail as they are not in the search path + # this is ok behavior, unfortunately we could be hiding other import bugs + pass except Exception: - log.exception('Failed to evaluate expression in namespace', exc_info=True) + log.exception('Failed to evaluate import expression "{0}"'.format(expr), exc_info=True) pass for id, expr in self.get_python_modules(): -- cgit v1.2.3