diff --git a/IPython/zmq/heartbeat.py b/IPython/zmq/heartbeat.py index 049483e..16e6ce4 100644 --- a/IPython/zmq/heartbeat.py +++ b/IPython/zmq/heartbeat.py @@ -41,7 +41,8 @@ class Heartbeat(Thread): self.port = s.getsockname()[1] s.close() elif addr[0] == 'ipc': - while os.path.exists(self.ip + '-' + self.port): + self.port = 1 + while os.path.exists("%s-%s" % (self.ip, self.port)): self.port = self.port + 1 else: raise ValueError("Unrecognized zmq transport: %s" % addr[0])