| 123456789101112131415161718192021222324252627282930313233 |
- # -*- coding: utf-8 -*-
- '''
- 用于读取config.json
- 无需定时
- '''
- import json
- import os
- import sys
- def load_config():
- try:
- sys.path.append(os.path.join(os.getcwd().split('auto_news_scheduler')[0], 'auto_news_scheduler'))
- base_project = os.path.join(os.getcwd().split('auto_news_scheduler')[0], 'auto_news_scheduler')
- 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_news_scheduler')[0], 'auto_news_scheduler')
|