diff --git a/ftplugin/python/vim_ipython.py b/ftplugin/python/vim_ipython.py index 0a4ed08..abb7ebc 100644 --- a/ftplugin/python/vim_ipython.py +++ b/ftplugin/python/vim_ipython.py @@ -93,7 +93,7 @@ def new_ipy(s=''): new_ipy() """ - from IPython.kernel import KernelManager + from jupyter_client.manager import KernelManager km = KernelManager() km.start_kernel() return km_from_string(km.connection_file) @@ -109,10 +109,8 @@ def km_from_string(s=''): raise ImportError("Could not find IPython. " + _install_instructions) from IPython.config.loader import KeyValueConfigLoader try: - from IPython.kernel import ( - KernelManager, - find_connection_file, - ) + from jupyter_client.manager import KernelManager + from jupyter_client.connect import find_connection_file except ImportError: # IPython < 1.0 from IPython.zmq.blockingkernelmanager import BlockingKernelManager as KernelManager @@ -141,8 +139,10 @@ def km_from_string(s=''): k = k.lstrip().rstrip() # kernel part of the string p = p.lstrip().rstrip() # profile part of the string fullpath = find_connection_file(k,p) - else: + elif len(s.lstrip().rstrip()): fullpath = find_connection_file(s.lstrip().rstrip()) + else: + fullpath = find_connection_file() except IOError as e: echo(":IPython " + s + " failed", "Info") echo("^-- failed '" + s + "' not found", "Error")