mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Multiple paths and environment inheritance.
- PYPE_MODULE_ROOT and PYPE_PYTHON_EXE had multiple paths. - The environment was not inherited, so need to explicitly pass it onwards.
This commit is contained in:
parent
15a6cbb820
commit
4d31caad67
1 changed files with 36 additions and 8 deletions
|
|
@ -61,19 +61,47 @@ class ExtractBurnin(pype.api.Extractor):
|
||||||
self.log.debug("__ burnin_data2: {}".format(burnin_data))
|
self.log.debug("__ burnin_data2: {}".format(burnin_data))
|
||||||
|
|
||||||
json_data = json.dumps(burnin_data)
|
json_data = json.dumps(burnin_data)
|
||||||
scriptpath = os.path.normpath(os.path.join(os.environ['PYPE_MODULE_ROOT'],
|
|
||||||
"pype",
|
# Get script path.
|
||||||
"scripts",
|
module_path = os.environ['PYPE_MODULE_ROOT']
|
||||||
"otio_burnin.py"))
|
|
||||||
|
# There can be multiple paths in PYPE_MODULE_ROOT, in which case
|
||||||
|
# we just take first one.
|
||||||
|
if os.pathsep in module_path:
|
||||||
|
module_path = module_path.split(os.pathsep)[0]
|
||||||
|
|
||||||
|
scriptpath = os.path.normpath(
|
||||||
|
os.path.join(
|
||||||
|
module_path,
|
||||||
|
"pype",
|
||||||
|
"scripts",
|
||||||
|
"otio_burnin.py"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
self.log.debug("__ scriptpath: {}".format(scriptpath))
|
self.log.debug("__ scriptpath: {}".format(scriptpath))
|
||||||
self.log.debug("__ EXE: {}".format(os.getenv("PYPE_PYTHON_EXE")))
|
|
||||||
|
# Get executable.
|
||||||
|
executable = os.getenv("PYPE_PYTHON_EXE")
|
||||||
|
|
||||||
|
# There can be multiple paths in PYPE_PYTHON_EXE, in which case
|
||||||
|
# we just take first one.
|
||||||
|
if os.pathsep in executable:
|
||||||
|
executable = executable.split(os.pathsep)[0]
|
||||||
|
|
||||||
|
self.log.debug("__ EXE: {}".format(executable))
|
||||||
|
|
||||||
|
self.log.debug(json.dumps(os.environ, indent=4))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(
|
args = [executable, scriptpath, json_data]
|
||||||
[os.getenv("PYPE_PYTHON_EXE"), scriptpath, json_data]
|
self.log.debug("Executing: {}".format(args))
|
||||||
)
|
|
||||||
|
# Explicitly passing the environment, because there are cases
|
||||||
|
# where enviroment is not inherited.
|
||||||
|
p = subprocess.Popen(args, env=os.environ)
|
||||||
p.wait()
|
p.wait()
|
||||||
|
|
||||||
if not os.path.isfile(full_burnin_path):
|
if not os.path.isfile(full_burnin_path):
|
||||||
raise RuntimeError("File not existing: {}".format(full_burnin_path))
|
raise RuntimeError("File not existing: {}".format(full_burnin_path))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue