mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge pull request #3547 from pypeclub/bugfix/OP-3612_Blender-import-error-from-openpype_interfaces
Module interfaces: Fix import error
This commit is contained in:
commit
b39ce4374c
1 changed files with 3 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ class _ModuleClass(object):
|
||||||
Object of this class can be stored to `sys.modules` and used for storing
|
Object of this class can be stored to `sys.modules` and used for storing
|
||||||
dynamically imported modules.
|
dynamically imported modules.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
# Call setattr on super class
|
# Call setattr on super class
|
||||||
super(_ModuleClass, self).__setattr__("name", name)
|
super(_ModuleClass, self).__setattr__("name", name)
|
||||||
|
|
@ -116,12 +117,13 @@ class _InterfacesClass(_ModuleClass):
|
||||||
- this is because interfaces must be available even if are missing
|
- this is because interfaces must be available even if are missing
|
||||||
implementation
|
implementation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __getattr__(self, attr_name):
|
def __getattr__(self, attr_name):
|
||||||
if attr_name not in self.__attributes__:
|
if attr_name not in self.__attributes__:
|
||||||
if attr_name in ("__path__", "__file__"):
|
if attr_name in ("__path__", "__file__"):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
raise ImportError((
|
raise AttributeError((
|
||||||
"cannot import name '{}' from 'openpype_interfaces'"
|
"cannot import name '{}' from 'openpype_interfaces'"
|
||||||
).format(attr_name))
|
).format(attr_name))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue