Use a better error message to help debug what is going on. I don't see how that regex could fail off the top of my head, even an empty string should match and return '' and '' for the groups.
(update: What we're seeing after this is that somehow the parser is getting a "line" that contains newlines at times; not sure how) Signed-off-by: Gregory Smith <[email protected]> --- autotest/tko/parsers/version_0.py 2010-05-27 10:49:16.000000000 -0700 +++ autotest/tko/parsers/version_0.py 2011-02-17 12:24:43.000000000 -0800 @@ -251,7 +251,13 @@ def parse_line(cls, line): if not status_line.is_status_line(line): return None - indent, line = re.search(r"^(\t*)(.*)$", line).groups() + match = re.search(r"^(\t*)(.*)$", line) + if not match: + # A more useful error message than: + # AttributeError: 'NoneType' object has no attribute 'groups' + # to help us debug WTF happens on occasion here. + raise RuntimeError("line %r could not be parsed." % line) + indent, line = match.groups() indent = len(indent) # split the line into the fixed and optional fields _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
