23 lines
821 B
Python
23 lines
821 B
Python
# -*- coding: utf-8 -*-
|
|
import json, py_compile, os
|
|
|
|
base = r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\behavior_pack_kcH4M5u0"
|
|
|
|
# 1. JSON 语法检查
|
|
for jf in [
|
|
os.path.join(base, "netease_items_beh", "dn_sa_matchbox.json"),
|
|
os.path.join(base, "manifest.json"),
|
|
]:
|
|
with open(jf, "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
print("JSON OK:", os.path.basename(jf), "->", data)
|
|
|
|
# 2. Python 脚本语法检查(py_compile,本机为 Python3,语法为 py2/py3 兼容)
|
|
for pf in ["scripts/__init__.py", "scripts/modMain.py", "scripts/matchboxServer.py"]:
|
|
p = os.path.join(base, pf)
|
|
try:
|
|
py_compile.compile(p, doraise=True)
|
|
print("PY OK:", pf)
|
|
except py_compile.PyCompileError as e:
|
|
print("PY ERROR:", pf, e)
|