Show More
@@ -11,9 +11,11 b'' | |||||
11 | # Imports |
|
11 | # Imports | |
12 | #----------------------------------------------------------------------------- |
|
12 | #----------------------------------------------------------------------------- | |
13 |
|
13 | |||
|
14 | import errno | |||
14 | import logging |
|
15 | import logging | |
15 | import os |
|
16 | import os | |
16 | import signal |
|
17 | import signal | |
|
18 | import socket | |||
17 | import sys |
|
19 | import sys | |
18 |
|
20 | |||
19 | import zmq |
|
21 | import zmq | |
@@ -213,7 +215,18 b' class IPythonNotebookApp(BaseIPythonApplication):' | |||||
213 | self.log.critical('WARNING: the notebook server is listening on all IP addresses ' |
|
215 | self.log.critical('WARNING: the notebook server is listening on all IP addresses ' | |
214 | 'but not using any encryption or authentication. This is highly ' |
|
216 | 'but not using any encryption or authentication. This is highly ' | |
215 | 'insecure and not recommended.') |
|
217 | 'insecure and not recommended.') | |
216 | self.http_server.listen(self.port, self.ip) |
|
218 | for i in range(10): | |
|
219 | try: | |||
|
220 | port = self.port + i | |||
|
221 | self.http_server.listen(port, self.ip) | |||
|
222 | except socket.error, e: | |||
|
223 | if e.errno != errno.EADDRINUSE: | |||
|
224 | raise | |||
|
225 | self.log.info('The port %i is already in use, trying: %i' % (port, port+1)) | |||
|
226 | else: | |||
|
227 | self.port = port | |||
|
228 | break | |||
|
229 | ||||
217 |
|
230 | |||
218 | def start(self): |
|
231 | def start(self): | |
219 | ip = self.ip if self.ip else '[all ip addresses on your system]' |
|
232 | ip = self.ip if self.ip else '[all ip addresses on your system]' |
General Comments 0
You need to be logged in to leave comments.
Login now