From cc9cfb42d214ddb787b9c182365a429a5a476190 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Wed, 27 Feb 2013 10:03:03 -0800 Subject: Prevent hacking.py from crashing on unexpected import exception If a module isn't importable due to an unexpected error during __import__. Ignore it, hacking.py is only a style checker. Fix bug 1134622 Change-Id: I704b7cc9a7bd415018ae7634767b7bd9c3b7d9b2 --- tools/hacking.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools') diff --git a/tools/hacking.py b/tools/hacking.py index dbb4fbe79..03e46d738 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -29,6 +29,7 @@ import re import subprocess import sys import tokenize +import traceback import pep8 @@ -210,6 +211,11 @@ def nova_import_rules(logical_line): _missingImport.add(missing) return True return False + except Exception, exc: + # NOTE(jogo) don't stack trace if unexpected import error, + # log and continue. + traceback.print_exc() + return False return True def is_module(mod): -- cgit