From 18c5e3a2425af1986187875835e805ce045c4420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez?= Date: Fri, 17 Jun 2022 21:59:24 +0200 Subject: [PATCH] Fixed logger on Windows (import mistake) --- actor/src/actor_client.py | 2 +- actor/src/udsactor/__init__.py | 1 - actor/src/udsactor/tools.py | 7 +++---- actor/src/udsactor/windows/log.py | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/actor/src/actor_client.py b/actor/src/actor_client.py index d285f7f9..6a4d44b0 100755 --- a/actor/src/actor_client.py +++ b/actor/src/actor_client.py @@ -67,7 +67,7 @@ if __name__ == "__main__": # Note: Signals are only checked on python code execution, so we create a timer to force call back to python timer = QTimer(qApp) timer.start(1000) - timer.timeout.connect(lambda *a: None) # timeout can be connected to a callable + timer.timeout.connect(lambda *a: None) # type: ignore # timeout can be connected to a callable qApp.exec() diff --git a/actor/src/udsactor/__init__.py b/actor/src/udsactor/__init__.py index 2fa9dded..630f9f4d 100644 --- a/actor/src/udsactor/__init__.py +++ b/actor/src/udsactor/__init__.py @@ -31,7 +31,6 @@ from . import types from . import rest from . import platform -from . import tools __title__ = 'udsactor' __author__ = 'Adolfo Gómez ' diff --git a/actor/src/udsactor/tools.py b/actor/src/udsactor/tools.py index c924865b..a39a39e7 100644 --- a/actor/src/udsactor/tools.py +++ b/actor/src/udsactor/tools.py @@ -28,23 +28,23 @@ ''' @author: Adolfo Gómez, dkmaster at dkmon dot com ''' -from re import I import threading import ipaddress import typing -from udsactor.log import logger - if typing.TYPE_CHECKING: from udsactor.types import InterfaceInfoType class ScriptExecutorThread(threading.Thread): + def __init__(self, script: str) -> None: super(ScriptExecutorThread, self).__init__() self.script = script def run(self) -> None: + from udsactor.log import logger + try: logger.debug('Executing script: {}'.format(self.script)) exec(self.script, globals(), None) # pylint: disable=exec-used @@ -69,7 +69,6 @@ def validNetworkCards( try: subnet = strToNoIPV4Network(net) except Exception as e: - logger.error('Invalid network: {}'.format(e)) subnet = None if subnet is None: diff --git a/actor/src/udsactor/windows/log.py b/actor/src/udsactor/windows/log.py index 1296f9de..263fb985 100644 --- a/actor/src/udsactor/windows/log.py +++ b/actor/src/udsactor/windows/log.py @@ -35,7 +35,6 @@ import tempfile import typing import servicemanager -from udsactor import service # pylint: disable=import-error # Valid logging levels, from UDS Broker (uds.core.utils.log). from .. import loglevel