diff --git a/pype/lib/applications.py b/pype/lib/applications.py index c7d6464418..253ffa0ad2 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -1,5 +1,4 @@ import os -import copy import platform import inspect import subprocess @@ -531,15 +530,23 @@ class ApplicationLaunchContext: self.launch_args = executable.as_args() # Handle launch environemtns - passed_env = self.data.pop("env", None) - if passed_env is None: + env = self.data.pop("env", None) + if env is not None and not isinstance(env, dict): + self.log.warning(( + "Passed `env` kwarg has invalid type: {}. Expected: `dict`." + " Using `os.environ` instead." + ).format(str(type(env)))) + env = None + + if env is None: env = os.environ - else: - env = passed_env # subprocess.Popen keyword arguments self.kwargs = { - "env": copy.deepcopy(env) + "env": { + key: str(value) + for key, value in env.items() + } } if platform.system().lower() == "windows":