mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Load plugin modules with importlib so we can debug symbols
This commit is contained in:
parent
ab5ef5469f
commit
7dd5c42ec9
1 changed files with 10 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import inspect
|
|||
import copy
|
||||
import tempfile
|
||||
import xml.etree.ElementTree
|
||||
import importlib
|
||||
|
||||
import six
|
||||
import pyblish.plugin
|
||||
|
|
@ -305,8 +306,15 @@ def publish_plugins_discover(paths=None):
|
|||
module.__file__ = abspath
|
||||
|
||||
try:
|
||||
with open(abspath, "rb") as f:
|
||||
six.exec_(f.read(), module.__dict__)
|
||||
if six.PY3:
|
||||
# Use loader so module has full specs
|
||||
module_loader = importlib.machinery.SourceFileLoader(
|
||||
mod_name, abspath
|
||||
)
|
||||
module_loader.exec_module(module)
|
||||
else:
|
||||
with open(abspath, "rb") as f:
|
||||
six.exec_(f.read(), module.__dict__)
|
||||
|
||||
# Store reference to original module, to avoid
|
||||
# garbage collection from collecting it's global
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue