From 56fa18c7ade7e4ca781779cd795a7bf4f4bd462d 2014-03-19 16:40:04 From: Thomas Kluyver Date: 2014-03-19 16:40:04 Subject: [PATCH] Fix import of socketserver on Python 3. Closes gh-5382 --- diff --git a/IPython/external/ssh/forward.py b/IPython/external/ssh/forward.py index 983ee51..2d61946 100644 --- a/IPython/external/ssh/forward.py +++ b/IPython/external/ssh/forward.py @@ -29,16 +29,19 @@ from __future__ import print_function import logging import select -import SocketServer +try: # Python 3 + import socketserver +except ImportError: # Python 2 + import SocketServer as socketserver logger = logging.getLogger('ssh') -class ForwardServer (SocketServer.ThreadingTCPServer): +class ForwardServer (socketserver.ThreadingTCPServer): daemon_threads = True allow_reuse_address = True -class Handler (SocketServer.BaseRequestHandler): +class Handler (socketserver.BaseRequestHandler): def handle(self): try: