Problems encountered with plugin code since upgrade to 2.1.7.0
Hi,
I have written a plugin which I've been running a enhancing for quite some time.
It is quite complex and I had structured my python project into a number of packages.
With the recent upgrade of the Framework bundle to 2.1.7.0 the import statements at the top of my __init__.py now fail with an ImportError.
From looking through code.py and core.py it seems like things have been tightened up about where imports can source their files from.
I've looked through options like moving my code to "Shared Code" but these don't seem to solve the problem and I can't see any other way to add my packages to host._custom_paths which look as though they might otherwise work.
Is there something I'm missing?.. perhaps an Info.plist setting that I can use to influence the behaviour of the plugin loader?
Yes, you’re correct - 2.1.7.0 changed the import mechanism. The framework uses a sandbox-like feature to isolate code running within a plug-in (the main plug-in code runs separately to any service code that might be loaded), but we discovered a bug in the import system that could cause certain functions to pollute the namespaces of other sandboxes. To work around this, we needed to rewrite the code to handle imports without going through the “sys” module.
Can you post the import lines of your code? The different syntaxes of the import statement invoke the underlying code in slightly different ways - there’s probably just a case that we missed. The goal when making the changes was to handle all code that worked with 2.1.6, and the few plug-ins using imports that we tested it with work fine.