You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
797 B
34 lines
797 B
# -*- coding: utf-8 -*-
|
|
'''
|
|
用于读取config.json
|
|
无需定时
|
|
'''
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.join(os.path.abspath(__file__).split('auto')[0] + 'auto'))
|
|
|
|
def load_config():
|
|
try:
|
|
sys.path.append(os.path.join(os.getcwd().split('auto')[0], 'auto'))
|
|
base_project = os.path.join(os.getcwd().split('auto')[0], 'auto')
|
|
|
|
config_path = os.path.join(base_project, 'config.json')
|
|
config_json = {}
|
|
with open(config_path, 'r') as f:
|
|
config_json = json.load(f)
|
|
|
|
if not config_json:
|
|
print('No config file found')
|
|
exit(0)
|
|
except Exception as e:
|
|
print(e)
|
|
exit(0)
|
|
|
|
return config_json
|
|
|
|
|
|
def get_base_path():
|
|
return os.path.join(os.getcwd().split('auto')[0], 'auto')
|
|
|