diff --git a/IPython/frontend/qt/console/qtconsoleapp.py b/IPython/frontend/qt/console/qtconsoleapp.py index 29e3597..96fb0ba 100644 --- a/IPython/frontend/qt/console/qtconsoleapp.py +++ b/IPython/frontend/qt/console/qtconsoleapp.py @@ -42,6 +42,7 @@ from IPython.frontend.qt.console import styles from IPython.frontend.qt.kernelmanager import QtKernelManager from IPython.parallel.util import select_random_ports from IPython.utils.path import filefind +from IPython.utils.py3compat import str_to_bytes from IPython.utils.traitlets import ( Dict, List, Unicode, Int, CaselessStrEnum, CBool, Any ) @@ -404,7 +405,7 @@ class IPythonQtConsoleApp(BaseIPythonApplication): # not overridden by config or cl_args setattr(self, name, cfg[name]) if 'key' in cfg: - self.config.Session.key = cfg['key'] + self.config.Session.key = str_to_bytes(cfg['key']) def init_ssh(self): """set up ssh tunnels, if needed.""" diff --git a/IPython/zmq/entry_point.py b/IPython/zmq/entry_point.py index 9c4e549..c54664e 100644 --- a/IPython/zmq/entry_point.py +++ b/IPython/zmq/entry_point.py @@ -15,12 +15,13 @@ from zmq.utils import jsonapi as json # IPython imports from IPython.utils.localinterfaces import LOCALHOST +from IPython.utils.py3compat import bytes_to_str # Local imports. from parentpoller import ParentPollerWindows def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=0, - ip=LOCALHOST, key=''): + ip=LOCALHOST, key=b''): """Generates a JSON config file, including the selection of random ports. Parameters @@ -79,7 +80,7 @@ def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, hb_port=hb_port, ) cfg['ip'] = ip - cfg['key'] = key + cfg['key'] = bytes_to_str(key) with open(fname, 'wb') as f: f.write(json.dumps(cfg, indent=2)) diff --git a/IPython/zmq/kernelapp.py b/IPython/zmq/kernelapp.py index b990808..5d536a2 100644 --- a/IPython/zmq/kernelapp.py +++ b/IPython/zmq/kernelapp.py @@ -31,6 +31,7 @@ from IPython.core.application import ( from IPython.utils import io from IPython.utils.localinterfaces import LOCALHOST from IPython.utils.path import filefind +from IPython.utils.py3compat import str_to_bytes from IPython.utils.traitlets import (Any, Instance, Dict, Unicode, Int, Bool, DottedObjectName) from IPython.utils.importstring import import_item @@ -176,7 +177,7 @@ class KernelApp(BaseIPythonApplication): # not overridden by config or cl_args setattr(self, name, cfg[name]) if 'key' in cfg: - self.config.Session.key = cfg['key'] + self.config.Session.key = str_to_bytes(cfg['key']) def write_connection_file(self): """write connection info to JSON file"""