From 41efe592c5c95a1d66644057dcd3a98188d4c4a3 2015-06-16 10:02:42 From: Brian Gough Date: 2015-06-16 10:02:42 Subject: [PATCH] support self.ports as dict or list in cleanup_ipc_files zmq uses a dict instead of a list --- diff --git a/IPython/kernel/connect.py b/IPython/kernel/connect.py index 0c84811..e1902dd 100644 --- a/IPython/kernel/connect.py +++ b/IPython/kernel/connect.py @@ -472,7 +472,12 @@ class ConnectionFileMixin(LoggingConfigurable): """Cleanup ipc files if we wrote them.""" if self.transport != 'ipc': return - for port in self.ports: + # handle self.ports as a list [port1, ...] or dictionary + # {label1: port1, ...} + ports = self.ports + if isinstance(ports, dict): + ports = ports.values() + for port in ports: ipcfile = "%s-%i" % (self.ip, port) try: os.remove(ipcfile)