Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind the HTTPServer in start #6061

Merged
merged 1 commit into from
May 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1792,12 +1792,6 @@ def init_webapp(self):
max_body_size=self.max_body_size,
max_buffer_size=self.max_buffer_size)

success = self._bind_http_server()
if not success:
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
self.exit(1)

def _bind_http_server(self):
return self._bind_http_server_unix() if self.sock else self._bind_http_server_tcp()

Expand Down Expand Up @@ -2297,6 +2291,12 @@ def start(self):
self.log.critical(_("Running as root is not recommended. Use --allow-root to bypass."))
self.exit(1)

success = self._bind_http_server()
if not success:
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
self.exit(1)

info = self.log.info
for line in self.notebook_info(kernel_count=False).split("\n"):
info(line)
Expand Down