scripts: logging/dictionary: fixes pylint warnings

Fixes some easy pylint warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
diff --git a/scripts/logging/dictionary/log_parser.py b/scripts/logging/dictionary/log_parser.py
index 273b0cc..a77e8fe 100755
--- a/scripts/logging/dictionary/log_parser.py
+++ b/scripts/logging/dictionary/log_parser.py
@@ -42,22 +42,11 @@
     return argparser.parse_args()
 
 
-def main():
-    """Main function of log parser"""
-    args = parse_args()
-
-    # Setup logging for parser
-    logging.basicConfig(format=LOGGER_FORMAT)
-    if args.debug:
-        logger.setLevel(logging.DEBUG)
-    else:
-        logger.setLevel(logging.INFO)
-
-    # Read from database file
-    database = LogDatabase.read_json_database(args.dbfile)
-    if database is None:
-        logger.error("ERROR: Cannot open database file: %s, exiting...", args.dbfile)
-        sys.exit(1)
+def read_log_file(args):
+    """
+    Read the log from file
+    """
+    logdata = None
 
     # Open log data file for reading
     if args.hex:
@@ -67,7 +56,7 @@
         else:
             hexdata = ''
 
-            with open(args.logfile, "r") as hexfile:
+            with open(args.logfile, "r", encoding="iso-8859-1") as hexfile:
                 for line in hexfile.readlines():
                     hexdata += line.strip()
 
@@ -109,6 +98,31 @@
 
         logfile.close()
 
+    return logdata
+
+
+def main():
+    """Main function of log parser"""
+    args = parse_args()
+
+    # Setup logging for parser
+    logging.basicConfig(format=LOGGER_FORMAT)
+    if args.debug:
+        logger.setLevel(logging.DEBUG)
+    else:
+        logger.setLevel(logging.INFO)
+
+    # Read from database file
+    database = LogDatabase.read_json_database(args.dbfile)
+    if database is None:
+        logger.error("ERROR: Cannot open database file: %s, exiting...", args.dbfile)
+        sys.exit(1)
+
+    logdata = read_log_file(args)
+    if logdata is None:
+        logger.error("ERROR: cannot read log from file: %s, exiting...", args.logfile)
+        sys.exit(1)
+
     log_parser = dictionary_parser.get_parser(database)
     if log_parser is not None:
         logger.debug("# Build ID: %s", database.get_build_id())