Create data directory if it doesn't exist

This commit is contained in:
TheKysek 2016-07-05 08:59:56 +02:00
parent e246c7558d
commit d5f4288a4e

View File

@ -14,6 +14,12 @@ import shared
def main():
logging.basicConfig(level=shared.log_level, format='[%(asctime)s] [%(levelname)s] %(message)s')
logging.info('Starting MiNode')
if not os.path.exists(shared.data_directory):
try:
os.makedirs(shared.data_directory)
except Exception as e:
logging.warning('Error while creating data directory in: {}'.format(shared.data_directory))
logging.warning(e)
try:
with open(shared.data_directory + 'objects.pickle', mode='br') as file:
shared.objects = pickle.load(file)