26 lines
609 B
Python
26 lines
609 B
Python
#!/usr/bin/python3
|
|
|
|
from json import load
|
|
from sys import argv
|
|
|
|
|
|
def import_from_default_path():
|
|
try:
|
|
with open('config.json') as config_file:
|
|
return load(config_file)
|
|
config_file.close()
|
|
except Exception as e:
|
|
print("Couldn't find the config file.")
|
|
exit(1)
|
|
|
|
|
|
def import_config_file():
|
|
if(len(argv) > 1):
|
|
try:
|
|
with open(argv[1]) as config_file:
|
|
return load(config_file)
|
|
config_file.close()
|
|
except:
|
|
return import_from_default_path()
|
|
else:
|
|
return import_from_default_path()
|