diff --git a/src/debug.py b/src/debug.py index fa6e4758..4d39ca23 100755 --- a/src/debug.py +++ b/src/debug.py @@ -44,7 +44,7 @@ try: import helper_startup import state except ModuleNotFoundError: - from pybitmessage import helper_startup, state + from pybitmessage import helper_startup from pybitmessage import state helper_startup.loadConfig() diff --git a/src/helper_startup.py b/src/helper_startup.py index 68f41707..79aedbde 100755 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -34,9 +34,11 @@ StoreConfigFilesInSameDirectoryAsProgramByDefault = False def loadConfig(): """Load the config""" + print('1111111111111111111111111111111111111111') config = BMConfigParser() if state.appdata: + print('if loadConfig state.appdata111 -{}'.format(state.appdata)) config.read(state.appdata + 'keys.dat') # state.appdata must have been specified as a startup option. needToCreateKeysFile = config.safeGet( @@ -46,19 +48,31 @@ def loadConfig(): 'Loading config files from directory specified' ' on startup: %s', state.appdata) else: + print('else loadConfig state.appdata2222 -{}'.format( + state.appdata)) config.read(paths.lookupExeFolder() + 'keys.dat') try: config.get('bitmessagesettings', 'settingsversion') + print('try bitmessagesettings', 'settingsversion -{}'.format( + config.get('bitmessagesettings', 'settingsversion'))) logger.info('Loading config files from same directory as program.') needToCreateKeysFile = False state.appdata = paths.lookupExeFolder() except: + print('load the config except except') # Could not load the keys.dat file in the program directory. # Perhaps it is in the appdata directory. state.appdata = paths.lookupAppdataFolder() config.read(state.appdata + 'keys.dat') needToCreateKeysFile = config.safeGet( 'bitmessagesettings', 'settingsversion') is None + print('needToCreateKeysFile -{}'.format( + needToCreateKeysFile)) + if not needToCreateKeysFile: + print( + 'needToCreateKeysFile is false means settingversion is not empty') + print(config.get( + 'bitmessagesettings','settingsversion')) if not needToCreateKeysFile: logger.info( 'Loading existing config files from %s', state.appdata) @@ -125,6 +139,10 @@ def loadConfig(): if not sys.platform.startswith('win'): os.umask(0o077) config.save() + print('7777777777777777777777777777777') + print('printing the bitmessage settings -{}'.format(config.get( + 'bitmessagesettings','settingsversion'))) + print('7777777777777777777777777777777') else: updateConfig() @@ -132,6 +150,7 @@ def loadConfig(): def updateConfig(): """Save the config""" config = BMConfigParser() + print('222222222222222222222222222222222222222') # Used python2.7 # settingsversion = int(BMConfigParser().get('bitmessagesettings', 'settingsversion') \ settingsversion = BMConfigParser().safeGetInt('bitmessagesettings', 'settingsvesion') @@ -277,8 +296,15 @@ def updateConfig(): # whatever the user selects. if not config.has_option('bitmessagesettings', 'ttl'): config.set('bitmessagesettings', 'ttl', '367200') - + print( + 'updateConfig111 congfig.get(bitmessagesettings, settingsversion) -{}'.format( + config.get('bitmessagesettings','settingsversion') + )) config.set('bitmessagesettings', 'settingsversion', str(settingsversion)) + print( + 'updateConfig222 congfig.get(bitmessagesettings, settingsversion) -{}'.format( + config.get('bitmessagesettings','settingsversion') + )) config.save() diff --git a/src/tests/test_process.py b/src/tests/test_process.py index 1faff471..2db0fffd 100755 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -9,8 +9,6 @@ import tempfile import time import unittest -from pybitmessage.debug import logger - try: import psutil except ModuleNotFoundError: @@ -37,6 +35,7 @@ class TestProcessProto(unittest.TestCase): @classmethod def setUpClass(cls): """Setup environment and start pybitmessage""" + cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir() put_signal_file(cls.home, 'unittest.lock') subprocess.call(cls._process_cmd) # nosec