sciurius
|
|
« on: March 07, 2020, 08:03:17 PM » |
|
MMA 20.02, Fedora 31, Python 3.7.6.
Loading modules that use MMA/pluginsUtils.py may crash.
When the module calls setAuthor() or setDescription() and friends, pluginUtils.py calls (internally) _P().
_P() calls _getCallerFileName()
_getCallerFileName() processes all loaded modules, skipping modules that are None or do not have a __file__ attribute.
The __file__ attribute is then compared to the __file__ attribute of the calling module (the plugin). This crashes if the module has a __file__ attribute that is None.
Traceback (most recent call last): File "/home/jv/bin/mma", line 78, in <module> import MMA.main File "/home/jv/lib/mma/MMA/main.py", line 92, in <module> MMA.paths.readRC() File "/home/jv/lib/mma/MMA/paths.py", line 118, in readRC MMA.parse.parseFile(f) File "/home/jv/lib/mma/MMA/parse.py", line 91, in parseFile parse(f) File "/home/jv/lib/mma/MMA/parse.py", line 161, in parse simpleFuncs[action](l[1:]) File "/home/jv/lib/mma/MMA/regplug.py", line 405, in plugin registerPlugin(p) File "/home/jv/lib/mma/MMA/regplug.py", line 295, in registerPlugin e = importlib.import_module(modName, package=None) File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/jv/lib/mma/plugins/customize/plugin.py", line 11, in <module> pu.setDescription("Customize MMA.") File "/home/jv/lib/mma/MMA/pluginUtils.py", line 103, in setDescription _P().DESCRIPTION = descr File "/home/jv/lib/mma/MMA/pluginUtils.py", line 94, in _P module = _getCallerModule() File "/home/jv/lib/mma/MMA/pluginUtils.py", line 81, in _getCallerModule if module.__file__.rpartition(".")[0] != f.rpartition(".")[0]: AttributeError: 'NoneType' object has no attribute 'rpartition'
On my system this happens with the python module ruamel.yaml. It is in the list sys.modules with name 'ruamel', has a __file__ attribute, but its value is None.
|