[issue19851] imp.reload problem with submodule

Ronald Oussoren report at bugs.python.org
Sun Dec 1 15:11:34 CET 2013


New submission from Ronald Oussoren:

To reproduce:

* create a package with the following structure:

    pkg/
      __init__.py
      _sub.py

* __init__.py contains:

   from pkg._sub import *

* the contents of _sub.py is not important

* in a python shell do:

>>> import pkg._sub as s
>>> import imp
>>> imp.reload(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 297, in reload
    return importlib.reload(module)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py", line 123, in reload
    raise ImportError(_bootstrap._ERR_MSG.format(name), name=name)
ImportError: No module named 'pkg._sub'
>>> 

In earlier python versions this reloaded the pkg._sub module.  Importing _sub from __init__ doesn't seem to be important.

----------
components: Library (Lib)
keywords: 3.3regression
messages: 204920
nosy: brett.cannon, eric.snow, ncoghlan, ronaldoussoren
priority: normal
severity: normal
stage: test needed
status: open
title: imp.reload problem with submodule
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19851>
_______________________________________


More information about the Python-bugs-list mailing list