Skip to content

Commit 2ae497d

Browse files
committed
parse profile in the conection string (closes #14)
1 parent 4c320ca commit 2ae497d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ftplugin/python/ipy.vim

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,20 @@ def km_from_string(s):
6868
# filefind also allows for absolute paths, in which case the search
6969
# is ignored
7070
try:
71-
fullpath = find_connection_file(s.lstrip().rstrip())
71+
# XXX: the following approach will be brittle, depending on what
72+
# connection strings will end up looking like in the future, and
73+
# whether or not they are allowed to have spaces. I'll have to sync
74+
# up with the IPython team to address these issues -pi
75+
if '--profile' in s:
76+
k,p = s.split('--profile')
77+
k = k.lstrip().rstrip() # kernel part of the string
78+
p = p.lstrip().rstrip() # profile part of the string
79+
fullpath = find_connection_file(k,p)
80+
else:
81+
fullpath = find_connection_file(s.lstrip().rstrip())
7282
except IOError,e:
7383
echo(":IPython " + s + " failed", "Info")
74-
echo("^-- failed --" + s + " not found", "Error")
84+
echo("^-- failed '" + s + "' not found", "Error")
7585
return
7686
km = BlockingKernelManager(connection_file = fullpath)
7787
km.load_connection_file()

0 commit comments

Comments
 (0)