Skip to content

Commit

Permalink
Backport PR #22490: PR: Prevent error when updating sys.path in con…
Browse files Browse the repository at this point in the history
…soles (IPython console)
  • Loading branch information
dalthviz authored and meeseeksmachine committed Sep 17, 2024
1 parent 456adad commit 949e11b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spyder/plugins/ipythonconsole/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,14 @@ def set_color_scheme(self, color_scheme, reset=True):
)

def update_syspath(self, path_dict, new_path_dict):
"""Update sys.path contents on kernel."""
self.call_kernel(
interrupt=True,
blocking=False).update_syspath(path_dict, new_path_dict)
"""Update sys.path contents in the kernel."""
# Prevent error when the kernel is not available and users open/close
# projects or use the Python path manager.
# Fixes spyder-ide/spyder#21563
if self.kernel_handler is not None:
self.call_kernel(interrupt=True, blocking=False).update_syspath(
path_dict, new_path_dict
)

def request_syspath(self):
"""Ask the kernel for sys.path contents."""
Expand Down

0 comments on commit 949e11b

Please sign in to comment.