python-lottie  0.6.11+devcecd248
A framework to work with lottie files and telegram animated stickers (tgs)
script.py
Go to the documentation of this file.
1 import json
2 import tempfile
3 import subprocess
4 from .base import importer
5 from ..objects import Animation
6 
7 
8 @importer("Python script", ["py"])
9 def import_python_script(file, *a, **kw):
10 
11  out = subprocess.check_output(["python", file, "--version"])
12  if b"python-lottie script" not in out:
13  raise Exception("Not a valid script")
14 
15  data = subprocess.check_output(["python", file, "--path", "", "--name", "-", "--format", "json"])
16  return Animation.load(json.loads(data))
lottie.importers.script.import_python_script
def import_python_script(file, *a, **kw)
Definition: script.py:9
lottie.importers.base.importer
importer
Definition: base.py:21