♻️ force modules to sys.path

This commit is contained in:
Ondrej Samohel 2023-02-01 12:38:02 +01:00
parent f764070183
commit b37359979c
No known key found for this signature in database
GPG key ID: 02376E18990A97C6

View file

@ -1,6 +1,20 @@
# -*- coding: utf-8 -*-
from openpype.hosts.max.api import MaxHost
from openpype.pipeline import install_host
import os
import sys
# this might happen in some 3dsmax version where PYTHONPATH isn't added
# to sys.path automatically
try:
from openpype.hosts.max.api import MaxHost
from openpype.pipeline import install_host
except (ImportError, ModuleNotFoundError):
for path in os.environ["PYTHONPATH"].split(os.pathsep):
if path and path not in sys.path:
sys.path.append(path)
from openpype.hosts.max.api import MaxHost
from openpype.pipeline import install_host
host = MaxHost()
install_host(host)