Skip to content

Commit

Permalink
Merge pull request #22523 from meeseeksmachine/auto-backport-of-pr-22…
Browse files Browse the repository at this point in the history
…490-on-6.x

Backport PR #22490 on branch 6.x (PR: Prevent error when updating `sys.path` in consoles (IPython console))
  • Loading branch information
dalthviz committed Sep 18, 2024
2 parents 456adad + 949e11b commit ada993e
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 ada993e

Please sign in to comment.