[issue21617] importlib reload can fail with AttributeError if module removed from sys.path

Michael Forbes report at bugs.python.org
Sun Jul 15 20:32:18 EDT 2018


Michael Forbes <mforbes at users.sourceforge.net> added the comment:

It seems that a reasonable workaround (if you generate your own `spec`) is to call `spec.loader.exec_module(mod)`.  This seems to reload the module into the same namespace. (I was afraid that it might replace the namespace hence the desire to use `importlib.reload()` explicitly.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21617>
_______________________________________


More information about the Python-bugs-list mailing list