diff --git a/pyblish/plugin.py b/pyblish/plugin.py index d51e9373..5aeaf2ee 100644 --- a/pyblish/plugin.py +++ b/pyblish/plugin.py @@ -1337,7 +1337,7 @@ def discover(type=None, regex=None, paths=None): module.__file__ = abspath try: - with open(abspath) as f: + with open(abspath, "rb") as f: six.exec_(f.read(), module.__dict__) # Store reference to original module, to avoid diff --git a/pyblish/version.py b/pyblish/version.py index c4e5c643..32463787 100644 --- a/pyblish/version.py +++ b/pyblish/version.py @@ -1,7 +1,7 @@ VERSION_MAJOR = 1 VERSION_MINOR = 8 -VERSION_PATCH = 6 +VERSION_PATCH = 7 version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) version = '%i.%i.%i' % version_info diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 61272a89..f67e9d2a 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1006,3 +1006,22 @@ def my_plugin_filter(plugins): pyblish.api.deregister_discovery_filter(my_plugin_filter) plugins = pyblish.api.discover() assert len(plugins) == 1, plugins + + +@with_setup(lib.setup_empty, lib.teardown) +def test_discovering_unicode_contained_plugin(): + unicode_plugin = b""" +import pyblish.api + +class UnicodePlugin(pyblish.api.InstancePlugin): + label = "\xf0\x9f\xa4\xa8" +""" + + with lib.tempdir() as d: + pyblish.api.register_plugin_path(d) + + with open(os.path.join(d, "unicode_plugin.py"), "wb") as f: + f.write(unicode_plugin) + + plugins = [p.__name__ for p in pyblish.api.discover()] + assert plugins == ["UnicodePlugin"]