This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
twitter_media_tool/lib/setup.py

27 lines
664 B
Python
Raw Normal View History

2020-04-24 14:38:39 -05:00
#!/usr/bin/python3
from json import load
2020-04-25 17:09:07 -05:00
from os import environ
2020-04-24 14:38:39 -05:00
def import_from_default_path():
try:
2020-04-25 17:09:07 -05:00
with open('config/config.json') as config_file:
2020-04-24 14:38:39 -05:00
return load(config_file)
config_file.close()
except Exception as e:
print("Couldn't find the config file.")
exit(1)
def import_config_file():
2020-04-25 17:09:07 -05:00
if('TMT_CONFIG_PATH' in environ.keys()):
2020-04-24 14:38:39 -05:00
try:
2020-04-25 17:09:07 -05:00
with open(f'{environ["TMT_CONFIG_PATH"]}') as config_file:
2020-04-24 14:38:39 -05:00
return load(config_file)
config_file.close()
except:
return import_from_default_path()
else:
return import_from_default_path()