mirror of
https://github.com/OpenVGLab/OmniLottie.git
synced 2026-09-17 15:46:26 +00:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import json
|
||||
import tempfile
|
||||
import subprocess
|
||||
from .base import importer
|
||||
from ..objects import Animation
|
||||
|
||||
|
||||
@importer("Python script", ["py"])
|
||||
def import_python_script(file, *a, **kw):
|
||||
|
||||
out = subprocess.check_output(["python", file, "--version"])
|
||||
if b"python-lottie script" not in out:
|
||||
raise Exception("Not a valid script")
|
||||
|
||||
data = subprocess.check_output(["python", file, "--path", "", "--name", "-", "--format", "json"])
|
||||
return Animation.load(json.loads(data))
|
||||
Reference in New Issue
Block a user