Added compatible idioms for configparser and queue to support both python2 and python3

This commit is contained in:
Kevin Larson 2019-06-03 18:22:25 -07:00
parent 823fda9c97
commit c4c1a10f05
2 changed files with 5 additions and 5 deletions

View file

@ -4,7 +4,7 @@ socket server request handlers leveraged by core servers.
import logging
import os
import queue
from queue import Queue, Empty
import shlex
import shutil
import socketserver
@ -69,7 +69,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
MessageTypes.EVENT.value: self.handle_event_message,
MessageTypes.SESSION.value: self.handle_session_message,
}
self.message_queue = queue.Queue()
self.message_queue = Queue()
self.node_status_request = {}
self._shutdown_lock = threading.Lock()
self._sessions_lock = threading.Lock()
@ -466,7 +466,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
try:
message = self.message_queue.get(timeout=1)
self.handle_message(message)
except queue.Empty:
except Empty:
pass
def handle_message(self, message):

View file

@ -6,7 +6,7 @@ message handlers are defined and some support for sending messages.
"""
import argparse
import configparser
from configparser import ConfigParser
import logging
import sys
import threading
@ -107,7 +107,7 @@ def get_merged_config(filename):
if args.configfile is not None:
filename = args.configfile
del args.configfile
cfg = configparser.ConfigParser(defaults)
cfg = ConfigParser(defaults)
cfg.read(filename)
section = "core-daemon"