Python 3 compatibility + correctly find maketx.exe on Windows

This commit is contained in:
Roy Nieterau 2021-12-28 18:19:33 +01:00
parent d090655764
commit 7cc0910549
2 changed files with 15 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import os
import platform
import uuid
import math
import sys
import json
import logging
@ -130,7 +131,13 @@ def float_round(num, places=0, direction=ceil):
def pairwise(iterable):
"""s -> (s0,s1), (s2,s3), (s4, s5), ..."""
a = iter(iterable)
return itertools.izip(a, a)
if sys.version_info[0] == 2:
izip = itertools.izip
else:
izip = zip
return izip(a, a)
def unique(name):

View file

@ -4,6 +4,7 @@ import os
import sys
import json
import tempfile
import platform
import contextlib
import subprocess
from collections import OrderedDict
@ -58,6 +59,11 @@ def maketx(source, destination, *args):
from openpype.lib import get_oiio_tools_path
maketx_path = get_oiio_tools_path("maketx")
if platform.system().lower() == "windows":
# Ensure .exe extension
maketx_path += ".exe"
if not os.path.exists(maketx_path):
print(
"OIIO tool not found in {}".format(maketx_path))
@ -212,7 +218,7 @@ class ExtractLook(openpype.api.Extractor):
self.log.info("Extract sets (%s) ..." % _scene_type)
lookdata = instance.data["lookData"]
relationships = lookdata["relationships"]
sets = relationships.keys()
sets = list(relationships.keys())
if not sets:
self.log.info("No sets found")
return