From a97bd7a26621c3013448f83ec9abe72a6044bec5 Mon Sep 17 00:00:00 2001 From: WhatTheServer Date: Sat, 29 Aug 2020 07:06:49 -0400 Subject: [PATCH] Update access-logparser.py Update access-logparser.py to account for when no matches in a file vs failing with error `AttributeError: 'NoneType' object has no attribute 'groupdict'` --- CPScripts/access-logparser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CPScripts/access-logparser.py b/CPScripts/access-logparser.py index 49533b71b..8c8ee06c9 100644 --- a/CPScripts/access-logparser.py +++ b/CPScripts/access-logparser.py @@ -14,7 +14,7 @@ __author__ = "Michael Ramsey" -__version__ = "0.1.1" +__version__ = "0.1.2" __license__ = "GPL-3.0" import os @@ -281,7 +281,12 @@ def main(): if re.match("(.*)(/admin[a-zA-Z0-9_]*$)(.*)", line): prestashop_hit_count = prestashop_hit_count + 1 m = pattern.match(line) - hit = m.groupdict() + if m is not None: + hit = m.groupdict() + else: + # print("re.search() returned None") + continue + # hit = m.groupdict() if ispage(hit): pages.append(pythonized(hit)) else: