##// END OF EJS Templates
protect kernelapp/qtconsole from invalid connection files...
MinRK -
Show More
@@ -17,6 +17,7 b' Authors:'
17 17 #-----------------------------------------------------------------------------
18 18
19 19 # stdlib imports
20 import json
20 21 import os
21 22 import signal
22 23 import sys
@@ -24,7 +25,6 b' import sys'
24 25 # System library imports
25 26 from IPython.external.qt import QtGui
26 27 from pygments.styles import get_all_styles
27 from zmq.utils import jsonapi as json
28 28
29 29 # Local imports
30 30 from IPython.config.application import boolean_flag
@@ -373,7 +373,11 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
373 373 # should load_connection_file only be used for existing?
374 374 # as it is now, this allows reusing ports if an existing
375 375 # file is requested
376 try:
376 377 self.load_connection_file()
378 except Exception:
379 self.log.error("Failed to load connection file: %r", self.connection_file, exc_info=True)
380 self.exit(1)
377 381
378 382 def load_connection_file(self):
379 383 """load ip/port/hmac config from JSON connection file"""
@@ -16,12 +16,12 b' Authors'
16 16 #-----------------------------------------------------------------------------
17 17
18 18 # Standard library imports.
19 import json
19 20 import os
20 21 import sys
21 22
22 23 # System library imports.
23 24 import zmq
24 from zmq.utils import jsonapi as json
25 25
26 26 # IPython imports.
27 27 from IPython.core.ultratb import FormattedTB
@@ -192,8 +192,11 b' class KernelApp(BaseIPythonApplication):'
192 192 def init_connection_file(self):
193 193 if not self.connection_file:
194 194 self.connection_file = "kernel-%s.json"%os.getpid()
195
195 try:
196 196 self.load_connection_file()
197 except Exception:
198 self.log.error("Failed to load connection file: %r", self.connection_file, exc_info=True)
199 self.exit(1)
197 200
198 201 def init_sockets(self):
199 202 # Create a context, a session, and the kernel sockets.
General Comments 0
You need to be logged in to leave comments. Login now