##// END OF EJS Templates
Add option for specifying Python executable to 'launch_kernel'.
epatters -
Show More
@@ -155,7 +155,7 b' def make_default_main(kernel_factory):'
155
155
156
156
157 def base_launch_kernel(code, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
157 def base_launch_kernel(code, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
158 independent=False, extra_arguments=[]):
158 executable=None, independent=False, extra_arguments=[]):
159 """ Launches a localhost kernel, binding to the specified ports.
159 """ Launches a localhost kernel, binding to the specified ports.
160
160
161 Parameters
161 Parameters
@@ -175,6 +175,9 b' def base_launch_kernel(code, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
175 hb_port : int, optional
175 hb_port : int, optional
176 The port to use for the hearbeat REP channel.
176 The port to use for the hearbeat REP channel.
177
177
178 executable : str, optional (default sys.executable)
179 The Python executable to use for the kernel process.
180
178 independent : bool, optional (default False)
181 independent : bool, optional (default False)
179 If set, the kernel process is guaranteed to survive if this process
182 If set, the kernel process is guaranteed to survive if this process
180 dies. If not set, an effort is made to ensure that the kernel is killed
183 dies. If not set, an effort is made to ensure that the kernel is killed
@@ -212,7 +215,9 b' def base_launch_kernel(code, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
212 hb_port = ports.pop(0)
215 hb_port = ports.pop(0)
213
216
214 # Build the kernel launch command.
217 # Build the kernel launch command.
215 arguments = [ sys.executable, '-c', code, '--xrep', str(xrep_port),
218 if executable is None:
219 executable = sys.executable
220 arguments = [ executable, '-c', code, '--xrep', str(xrep_port),
216 '--pub', str(pub_port), '--req', str(req_port),
221 '--pub', str(pub_port), '--req', str(req_port),
217 '--hb', str(hb_port) ]
222 '--hb', str(hb_port) ]
218 arguments.extend(extra_arguments)
223 arguments.extend(extra_arguments)
@@ -551,7 +551,7 b' class GTKKernel(Kernel):'
551 #-----------------------------------------------------------------------------
551 #-----------------------------------------------------------------------------
552
552
553 def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
553 def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
554 independent=False, pylab=False, colors=None):
554 executable=None, independent=False, pylab=False, colors=None):
555 """Launches a localhost kernel, binding to the specified ports.
555 """Launches a localhost kernel, binding to the specified ports.
556
556
557 Parameters
557 Parameters
@@ -571,6 +571,9 b' def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
571 hb_port : int, optional
571 hb_port : int, optional
572 The port to use for the hearbeat REP channel.
572 The port to use for the hearbeat REP channel.
573
573
574 executable : str, optional (default sys.executable)
575 The Python executable to use for the kernel process.
576
574 independent : bool, optional (default False)
577 independent : bool, optional (default False)
575 If set, the kernel process is guaranteed to survive if this process
578 If set, the kernel process is guaranteed to survive if this process
576 dies. If not set, an effort is made to ensure that the kernel is killed
579 dies. If not set, an effort is made to ensure that the kernel is killed
@@ -605,7 +608,7 b' def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
605 extra_arguments.append(colors)
608 extra_arguments.append(colors)
606 return base_launch_kernel('from IPython.zmq.ipkernel import main; main()',
609 return base_launch_kernel('from IPython.zmq.ipkernel import main; main()',
607 xrep_port, pub_port, req_port, hb_port,
610 xrep_port, pub_port, req_port, hb_port,
608 independent, extra_arguments)
611 executable, independent, extra_arguments)
609
612
610
613
611 def main():
614 def main():
@@ -248,7 +248,7 b' class Kernel(HasTraits):'
248 #-----------------------------------------------------------------------------
248 #-----------------------------------------------------------------------------
249
249
250 def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
250 def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,
251 independent=False):
251 executable=None, independent=False):
252 """ Launches a localhost kernel, binding to the specified ports.
252 """ Launches a localhost kernel, binding to the specified ports.
253
253
254 Parameters
254 Parameters
@@ -268,6 +268,9 b' def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
268 hb_port : int, optional
268 hb_port : int, optional
269 The port to use for the hearbeat REP channel.
269 The port to use for the hearbeat REP channel.
270
270
271 executable : str, optional (default sys.executable)
272 The Python executable to use for the kernel process.
273
271 independent : bool, optional (default False)
274 independent : bool, optional (default False)
272 If set, the kernel process is guaranteed to survive if this process
275 If set, the kernel process is guaranteed to survive if this process
273 dies. If not set, an effort is made to ensure that the kernel is killed
276 dies. If not set, an effort is made to ensure that the kernel is killed
@@ -288,7 +291,8 b' def launch_kernel(ip=None, xrep_port=0, pub_port=0, req_port=0, hb_port=0,'
288
291
289 return base_launch_kernel('from IPython.zmq.pykernel import main; main()',
292 return base_launch_kernel('from IPython.zmq.pykernel import main; main()',
290 xrep_port, pub_port, req_port, hb_port,
293 xrep_port, pub_port, req_port, hb_port,
291 independent, extra_arguments=extra_arguments)
294 executable, independent,
295 extra_arguments=extra_arguments)
292
296
293 main = make_default_main(Kernel)
297 main = make_default_main(Kernel)
294
298
General Comments 0
You need to be logged in to leave comments. Login now