Browse Source

search for config file

master
Sebastian Robinson 2 weeks ago
parent
commit
e1c7c9dde5
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      PDMameUpdate.py

+ 11
- 2
PDMameUpdate.py View File

@@ -48,6 +48,7 @@ import os
import re
import requests
import time
import pathlib
from clutch.core import Client
from tabulate import tabulate
from collections import defaultdict
@@ -58,8 +59,16 @@ from urllib.parse import quote
def open_config_file():
"""Reads configuration from config.json file"""

logging.info('Opening config file: config.json')
with open('config.json') as config_file:
for loc in os.environ.get("PDMAMEUPDATE_CONF"), "/etc", os.path.expanduser("~"), os.curdir:
if loc is not None:
config_path = loc + '/config.json'
if pathlib.Path(config_path).is_file():
config_file_loc = config_path
break

logging.info('Opening config file: '+config_file_loc)
config_file = None;
with open(config_file_loc, 'r') as config_file:
config = json.load(config_file)
return config


Loading…
Cancel
Save