From 10b04b8089f2a45752895ab9df05c22fc4e80ee0 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 12 Oct 2020 11:49:57 +0200 Subject: [PATCH] change list comprehension to for loop with if --- pype/hooks/tvpaint/prelaunch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pype/hooks/tvpaint/prelaunch.py b/pype/hooks/tvpaint/prelaunch.py index f3cc5757217..d616949254a 100644 --- a/pype/hooks/tvpaint/prelaunch.py +++ b/pype/hooks/tvpaint/prelaunch.py @@ -63,12 +63,12 @@ def execute(self, *args, env: dict = None) -> bool: proj_config_path = os.path.join( env["PYPE_PROJECT_CONFIGS"], project_name) if os.path.exists(proj_config_path): - self.log.info( - f"extension: `{extension}`") - template_file = next(( - f for f in os.listdir(proj_config_path) - if extension in os.path.splitext(f)[1] - )) + + template_file = None + for f in os.listdir(proj_config_path): + if extension in os.path.splitext(f): + template_file = f + if template_file: template_path = os.path.join( proj_config_path, template_file)