Closed philipstarkey closed 5 years ago
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
Global variables get set to None in modules before they are garbage collected.
Looks like mpl_toolkits does something funky with its imports, which is conflicting with the magic we do.
I notice mpl_toolkits is a 'builtin' module (it has no __file__
attribute). We probably shouldn't unload these. Or maybe we aren't, but we're unloading their dependencies.
Not sure. I'll look into it. Might consider just whitelisting everything in site-packages.
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
I'm not able to reproduce this, on Ubuntu at least. What versions of python, matplotlib, etc do you see this with? Windows, presumably?
Original comment by Philip Starkey (Bitbucket: philipstarkey, GitHub: philipstarkey).
Hmm odd. I'm using Python 2.7, matplotlib 1.5.1 on windows.
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
Well I'm using matplotlib 2.2, so would not be too surprising for it to be different. Is just upgrading a solution? The visual differences between version 1 and version 2 are pretty considerable, so maybe you don't want this as it would change the look of things with the data sharing for Shaun's paper.
Nonetheless I'll try downgrading to see if it reproduces.
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
Ok, I can reproduce and I see the problem.
setuptools.pkg_resources.extern.VendorImporter
, which is used by mpl_toolkits
to import its submodules, adds itself to sys.meta_path
(a list of objects for overriding import behaviour). The module it lives in is deleted from sys.modules
, but the importer instance is still in sys.meta_path
and one of its methods expects to be able to look up global variables still. That method gets called next time mpl_toolkits
tries to load some submodules, but that instance sees a global scope where everything is None
, and breaks.
Solution is likely to have ModuleWatcher
roll back sys.meta_path
the same way it rolls back sys.path
. I'll look into it.
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
This should be fixed by labscript_utils pull request 59.
Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
Original report (archived issue) by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).
I get a weird exception that implies that
sys
isNone
when using the following import in a lyse script (and then modifying the contents of another imported script, triggering modulewatcher to reload)The module to import is:
from mpl_toolkits.axes_grid.inset_locator import (inset_axes, InsetPosition, mark_inset)
.Once you trigger module watcher to reload anything else used by the script, and re-run the analysis, you get the following traceback:
It would be nice to get this fixed soon so that the fix can be in the version of lyse we specify to use with the data collection for @shjohnst vortex paper.