__author__ = "Sander Schulhoff" __email__ = "sanderschulhoff@gmail.com" import os import re from PIL import Image from tqdm import tqdm import gymnasium from utils import kill_strs # snake to camel case: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case # noqa: E501 pattern = re.compile(r"(? LENGTH: break env.close() # make sure video doesn't already exist # if not os.path.exists(os.path.join(v_path, env_name + ".gif")): frames[0].save( os.path.join("..", "_static", "videos", env_type, env_name + ".gif"), save_all=True, append_images=frames[1:], duration=50, loop=0, ) print("Saved: " + env_name) except BaseException as e: print("ERROR", e) continue