File indexing completed on 2025-01-19 03:59:52
0001 import json 0002 import tempfile 0003 import subprocess 0004 from .base import importer 0005 from ..objects import Animation 0006 0007 0008 @importer("Python script", ["py"]) 0009 def import_python_script(file, *a, **kw): 0010 0011 out = subprocess.check_output(["python", file, "--version"]) 0012 if b"python-lottie script" not in out: 0013 raise Exception("Not a valid script") 0014 0015 data = subprocess.check_output(["python", file, "--path", "", "--name", "-", "--format", "json"]) 0016 return Animation.load(json.loads(data))