Python3 compat

This commit is contained in:
Adolfo Gómez García 2018-10-24 08:35:08 +02:00
parent ba45e4c6d6
commit 861258532d
5 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,6 @@
build
dist
*.spec
.idea
*_enterprise*
/samples/

View File

@ -61,6 +61,7 @@ class Logger(object):
self.remoteLogger = remoteLogger
def log(self, level, message):
print(level)
if level < self.logLevel: # Skip not wanted messages
return

View File

@ -78,6 +78,7 @@ def initCfg():
class CommonService(object):
def __init__(self):
self.isAlive = True
self.api = None
@ -312,7 +313,7 @@ class CommonService(object):
except Exception:
logger.error('Couln\'t remove comms url from broker')
self.notifyStop()
# self.notifyStop()
# ***************************************************
# Methods that ARE overriden by linux & windows Actor

View File

@ -37,7 +37,7 @@ import os
import tempfile
# Valid logging levels, from UDS Broker (uds.core.utils.log)
OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in xrange(6))
OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in range(6))
class LocalLogger(object):
@ -58,7 +58,7 @@ class LocalLogger(object):
# our loglevels are 10000 (other), 20000 (debug), ....
# logging levels are 10 (debug), 20 (info)
# OTHER = logging.NOTSET
self.logger.log(level / 1000 - 10, message)
self.logger.log(level // 1000 - 10, message)
if level < INFO or self.serviceLogger is False: # Only information and above will be on event log
return

View File

@ -31,10 +31,13 @@
'''
from __future__ import unicode_literals
import pickle
from win32com.shell import shell # @UnresolvedImport, pylint: disable=import-error
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
try:
import winreg as wreg
except ImportError: # Python 2.7 fallback
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
import win32security # @UnresolvedImport, pylint: disable=import-error
import cPickle
DEBUG = False
@ -78,7 +81,7 @@ def readConfig():
key = wreg.OpenKey(baseKey, path, 0, wreg.KEY_QUERY_VALUE) # @UndefinedVariable
data, _ = wreg.QueryValueEx(key, '') # @UndefinedVariable
wreg.CloseKey(key) # @UndefinedVariable
return cPickle.loads(decoder(data))
return pickle.loads(decoder(data))
except Exception:
return None
@ -90,7 +93,7 @@ def writeConfig(data, fixPermissions=True):
if fixPermissions is True:
fixRegistryPermissions(key.handle)
wreg.SetValueEx(key, "", 0, wreg.REG_BINARY, encoder(cPickle.dumps(data))) # @UndefinedVariable
wreg.SetValueEx(key, "", 0, wreg.REG_BINARY, encoder(pickle.dumps(data))) # @UndefinedVariable
wreg.CloseKey(key) # @UndefinedVariable
def useOldJoinSystem():