diff --git a/IPython/core/extensions.py b/IPython/core/extensions.py index f3f6841..3669c79 100644 --- a/IPython/core/extensions.py +++ b/IPython/core/extensions.py @@ -13,7 +13,11 @@ from IPython.utils.path import ensure_dir_exists from traitlets import Instance from IPython.utils.py3compat import PY3 if PY3: - from imp import reload + try: + from importlib import reload + except ImportError : + ## deprecated since 3.4 + from imp import reload #----------------------------------------------------------------------------- # Main class diff --git a/IPython/utils/openpy.py b/IPython/utils/openpy.py index f63a91c..0a7cc0f 100644 --- a/IPython/utils/openpy.py +++ b/IPython/utils/openpy.py @@ -228,7 +228,11 @@ def _list_readline(x): # Code for going between .py files and cached .pyc files ---------------------- try: # Python 3.2, see PEP 3147 - from imp import source_from_cache, cache_from_source + try: + from importlib.util import source_from_cache, cache_from_source + except ImportError : + ## deprecated since 3.4 + from imp import source_from_cache, cache_from_source except ImportError: # Python <= 3.1: .pyc files go next to .py def source_from_cache(path):