fix PY-14472 Matplotlib import has failed in Python Console (AttributeError: 'module' object has no attribute 'rcParams')

This commit is contained in:
Elizaveta Shashkova
2014-11-24 12:35:21 +03:00
parent 24fd7ed5b9
commit 3781bd3aca
+9 -3
View File
@@ -26,10 +26,16 @@ class ImportHookManager(ModuleType):
else:
# default value for level parameter in other versions
level = -1
module = self._system_import(name, globals, locals, fromlist, level)
activate_func = None
if DictContains(self._modules_to_patch, name):
self._modules_to_patch[name]() #call activate function
self._modules_to_patch.pop(name)
activate_func = self._modules_to_patch.pop(name)
module = self._system_import(name, globals, locals, fromlist, level)
try:
if activate_func:
activate_func() #call activate function
except:
sys.stderr.write("Matplotlib support failed")
return module
try: