Skip to content

Commit

Permalink
Merge pull request #22490 from ccordoba12/issue-21563
Browse files Browse the repository at this point in the history
PR: Prevent error when updating `sys.path` in consoles (IPython console)
  • Loading branch information
dalthviz authored Sep 17, 2024
2 parents be3c654 + 48e7346 commit b65c1d5
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 b65c1d5

Please sign in to comment.