From 9ac7f9c790442a42da799e022dc976dbac91f41e 2015-06-21 20:57:48 From: Min RK Date: 2015-06-21 20:57:48 Subject: [PATCH] Merge pull request #8538 from sharelatex/fix-cleanup-ipc-files-for-zmq Fix exception in cleanup_ipc_files for zmq --- 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)