forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start jupyter notebooks even if notebook is not installed in currenv …
…env (microsoft#8977) * Start jupyter notebooks even if notebook is not installed in currenv env * Increase timeout of test
- Loading branch information
1 parent
b96e7a3
commit 7e70cb2
Showing
7 changed files
with
120 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
from notebook.notebookapp import list_running_servers | ||
import json | ||
try: | ||
from notebook.notebookapp import list_running_servers | ||
import json | ||
|
||
server_list = list_running_servers() | ||
server_list = list_running_servers() | ||
|
||
server_info_list = [] | ||
server_info_list = [] | ||
|
||
for si in server_list: | ||
server_info_object = {} | ||
server_info_object["base_url"] = si['base_url'] | ||
server_info_object["notebook_dir"] = si['notebook_dir'] | ||
server_info_object["hostname"] = si['hostname'] | ||
server_info_object["password"] = si['password'] | ||
server_info_object["pid"] = si['pid'] | ||
server_info_object["port"] = si['port'] | ||
server_info_object["secure"] = si['secure'] | ||
server_info_object["token"] = si['token'] | ||
server_info_object["url"] = si['url'] | ||
server_info_list.append(server_info_object) | ||
for si in server_list: | ||
server_info_object = {} | ||
server_info_object["base_url"] = si['base_url'] | ||
server_info_object["notebook_dir"] = si['notebook_dir'] | ||
server_info_object["hostname"] = si['hostname'] | ||
server_info_object["password"] = si['password'] | ||
server_info_object["pid"] = si['pid'] | ||
server_info_object["port"] = si['port'] | ||
server_info_object["secure"] = si['secure'] | ||
server_info_object["token"] = si['token'] | ||
server_info_object["url"] = si['url'] | ||
server_info_list.append(server_info_object) | ||
|
||
print(json.dumps(server_info_list)) | ||
print(json.dumps(server_info_list)) | ||
except Exception: | ||
import subprocess | ||
import sys | ||
result = subprocess.run(['jupyter', 'notebook', 'list', '--jsonlist'], capture_output=True) | ||
encoding = os.getenv('PYTHONIOENCODING', 'utf-8') | ||
print(result.stdout.decode(encoding)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
try: | ||
from notebook import notebookapp as app | ||
print("Available") | ||
except Exception: | ||
print("No") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters