Skip to content

Commit f354740

Browse files
authored
Merge pull request #5136 from pallavibharadwaj/issue_1914
descriptive log for port unavailable and port-retries=0
2 parents d0a7435 + 5996cdf commit f354740

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

notebook/notebookapp.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,10 +1490,13 @@ def init_webapp(self):
14901490
self.http_server.listen(port, self.ip)
14911491
except socket.error as e:
14921492
if e.errno == errno.EADDRINUSE:
1493-
self.log.info(_('The port %i is already in use, trying another port.') % port)
1493+
if self.port_retries:
1494+
self.log.info(_('The port %i is already in use, trying another port.') % port)
1495+
else:
1496+
self.log.info(_('The port %i is already in use.') % port)
14941497
continue
14951498
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
1496-
self.log.warning(_("Permission to listen on port %i denied") % port)
1499+
self.log.warning(_("Permission to listen on port %i denied.") % port)
14971500
continue
14981501
else:
14991502
raise
@@ -1502,8 +1505,12 @@ def init_webapp(self):
15021505
success = True
15031506
break
15041507
if not success:
1505-
self.log.critical(_('ERROR: the notebook server could not be started because '
1508+
if self.port_retries:
1509+
self.log.critical(_('ERROR: the notebook server could not be started because '
15061510
'no available port could be found.'))
1511+
else:
1512+
self.log.critical(_('ERROR: the notebook server could not be started because '
1513+
'port %i is not available.') % port)
15071514
self.exit(1)
15081515

15091516
@property

0 commit comments

Comments
 (0)