MCPcopy
hub / github.com/AstrBotDevs/AstrBot / check_env

Function check_env

main.py:72–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71
72def check_env() -> None:
73 if not (sys.version_info.major == 3 and sys.version_info.minor >= 10):
74 logger.error("请使用 Python3.10+ 运行本项目。")
75 exit()
76
77 astrbot_root = get_astrbot_root()
78 if astrbot_root not in sys.path:
79 sys.path.insert(0, astrbot_root)
80
81 site_packages_path = get_astrbot_site_packages_path()
82 if not is_packaged_desktop_runtime() and site_packages_path not in sys.path:
83 sys.path.append(site_packages_path)
84
85 os.makedirs(get_astrbot_config_path(), exist_ok=True)
86 os.makedirs(get_astrbot_plugin_path(), exist_ok=True)
87 os.makedirs(get_astrbot_temp_path(), exist_ok=True)
88 os.makedirs(get_astrbot_knowledge_base_path(), exist_ok=True)
89 os.makedirs(site_packages_path, exist_ok=True)
90
91 # 针对问题 #181 的临时解决方案
92 mimetypes.add_type("text/javascript", ".js")
93 mimetypes.add_type("text/javascript", ".mjs")
94 mimetypes.add_type("application/json", ".json")
95
96
97async def check_dashboard_files(webui_dir: str | None = None):

Calls 11

get_astrbot_rootFunction · 0.90
get_astrbot_config_pathFunction · 0.90
get_astrbot_plugin_pathFunction · 0.90
get_astrbot_temp_pathFunction · 0.90
exitFunction · 0.85
errorMethod · 0.45
insertMethod · 0.45
appendMethod · 0.45