Skip to content

Commit

Permalink
Pass in an explicit loader when making the import spec
Browse files Browse the repository at this point in the history
This fixes an issue where it's not able to run scripts with non-standard
suffixes (e.g. no suffix)
  • Loading branch information
JesusFreke committed Mar 23, 2022
1 parent e82b5fe commit a4d43cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fusion_idea_addin.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ def notify(self, args):
# This mostly mimics the package name that Fusion uses when running the script
module_name = "__main__" + urllib.parse.quote(script_path.replace('.', '_'))
spec = importlib.util.spec_from_file_location(
module_name, script_path, submodule_search_locations=[script_dir])
module_name, script_path,
loader=importlib.machinery.SourceFileLoader(module_name, script_path),
submodule_search_locations=[script_dir])

module = importlib.util.module_from_spec(spec)

existing_module = sys.modules.get(module_name)
Expand Down

0 comments on commit a4d43cb

Please sign in to comment.