Skip to content

Commit

Permalink
Redirect all package errors to the system stderr output on the curren…
Browse files Browse the repository at this point in the history
…t machine
  • Loading branch information
vladpunko committed Nov 21, 2021
1 parent c0c4bf1 commit e856736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notebook_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"show_kernels",
)

__version__ = "0.8.9"
__version__ = "0.8.10"


def _in_virtual_environment():
Expand Down Expand Up @@ -240,8 +240,8 @@ def _provide_required_packages():
try:
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "ipykernel"],
stderr=devnull,
stdout=devnull,
stderr=sys.stderr, # use this system stream to show all package errors
)
except subprocess.CalledProcessError as err:
_logger.error((
Expand Down Expand Up @@ -366,7 +366,7 @@ def initialize_new_notebook_environment():
sys.exit(errno.EPERM)

try:
from jupyter_core.paths import jupyter_path
from jupyter_core.paths import jupyter_path # noqa
except ImportError:
def jupyter_path(path): # this function is to return a list
return [_get_data_path(path)]
Expand Down
3 changes: 3 additions & 0 deletions notebook_environments_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(self):
# Use the standard system function to stop code execution.
self.exit = sys.exit

self.stdout = sys.stdout
self.stderr = sys.stderr

def activate(self):
# Start a new python virtual environment and keep it running.
self.prefix = "/root/.test"
Expand Down

0 comments on commit e856736

Please sign in to comment.