This commit is contained in:
listik committed 2026-11-29 15:49:17 +03:00
commit a85391509d
211 files changed
+28903

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
"""Send a Python file to the running Blender (Blender Lab MCP add-on on localhost:9876) and print the reply.
Usage: python send.py script.py
"""
import json
import socket
import sys
code = open(sys.argv[1], encoding="utf-8").read()
payload = (json.dumps({"type": "execute", "code": code, "strict_json": False}) + "\0").encode("utf-8")
with socket.create_connection(("localhost", 9876), timeout=600) as s:
s.sendall(payload)
buf = bytearray()
while b"\0" not in buf:
chunk = s.recv(65536)
if not chunk:
break
buf.extend(chunk)
end = buf.index(b"\0") if b"\0" in buf else len(buf)
print(json.dumps(json.loads(bytes(buf[:end])), ensure_ascii=False, indent=1))