##// END OF EJS Templates
py3compat pass on Session.key...
MinRK -
Show More
@@ -42,6 +42,7 b' from IPython.frontend.qt.console import styles'
42 from IPython.frontend.qt.kernelmanager import QtKernelManager
42 from IPython.frontend.qt.kernelmanager import QtKernelManager
43 from IPython.parallel.util import select_random_ports
43 from IPython.parallel.util import select_random_ports
44 from IPython.utils.path import filefind
44 from IPython.utils.path import filefind
45 from IPython.utils.py3compat import str_to_bytes
45 from IPython.utils.traitlets import (
46 from IPython.utils.traitlets import (
46 Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any
47 Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any
47 )
48 )
@@ -404,7 +405,7 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
404 # not overridden by config or cl_args
405 # not overridden by config or cl_args
405 setattr(self, name, cfg[name])
406 setattr(self, name, cfg[name])
406 if 'key' in cfg:
407 if 'key' in cfg:
407 self.config.Session.key = cfg['key']
408 self.config.Session.key = str_to_bytes(cfg['key'])
408
409
409 def init_ssh(self):
410 def init_ssh(self):
410 """set up ssh tunnels, if needed."""
411 """set up ssh tunnels, if needed."""
@@ -15,12 +15,13 b' from zmq.utils import jsonapi as json'
15
15
16 # IPython imports
16 # IPython imports
17 from IPython.utils.localinterfaces import LOCALHOST
17 from IPython.utils.localinterfaces import LOCALHOST
18 from IPython.utils.py3compat import bytes_to_str
18
19
19 # Local imports.
20 # Local imports.
20 from parentpoller import ParentPollerWindows
21 from parentpoller import ParentPollerWindows
21
22
22 def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=0,
23 def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=0,
23 ip=LOCALHOST, key=''):
24 ip=LOCALHOST, key=b''):
24 """Generates a JSON config file, including the selection of random ports.
25 """Generates a JSON config file, including the selection of random ports.
25
26
26 Parameters
27 Parameters
@@ -79,7 +80,7 b' def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, '
79 hb_port=hb_port,
80 hb_port=hb_port,
80 )
81 )
81 cfg['ip'] = ip
82 cfg['ip'] = ip
82 cfg['key'] = key
83 cfg['key'] = bytes_to_str(key)
83
84
84 with open(fname, 'wb') as f:
85 with open(fname, 'wb') as f:
85 f.write(json.dumps(cfg, indent=2))
86 f.write(json.dumps(cfg, indent=2))
@@ -31,6 +31,7 b' from IPython.core.application import ('
31 from IPython.utils import io
31 from IPython.utils import io
32 from IPython.utils.localinterfaces import LOCALHOST
32 from IPython.utils.localinterfaces import LOCALHOST
33 from IPython.utils.path import filefind
33 from IPython.utils.path import filefind
34 from IPython.utils.py3compat import str_to_bytes
34 from IPython.utils.traitlets import (Any, Instance, Dict, Unicode, Int, Bool,
35 from IPython.utils.traitlets import (Any, Instance, Dict, Unicode, Int, Bool,
35 DottedObjectName)
36 DottedObjectName)
36 from IPython.utils.importstring import import_item
37 from IPython.utils.importstring import import_item
@@ -176,7 +177,7 b' class KernelApp(BaseIPythonApplication):'
176 # not overridden by config or cl_args
177 # not overridden by config or cl_args
177 setattr(self, name, cfg[name])
178 setattr(self, name, cfg[name])
178 if 'key' in cfg:
179 if 'key' in cfg:
179 self.config.Session.key = cfg['key']
180 self.config.Session.key = str_to_bytes(cfg['key'])
180
181
181 def write_connection_file(self):
182 def write_connection_file(self):
182 """write connection info to JSON file"""
183 """write connection info to JSON file"""
General Comments 0
You need to be logged in to leave comments. Login now