Skip to content

Commit

Permalink
Editor: Catch an error when restoring files on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed May 27, 2021
1 parent d22f459 commit 166ed1f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,15 @@ def has_filename(self, filename):

def set_current_filename(self, filename, focus=True):
"""Set current filename and return the associated editor instance."""
index = self.has_filename(filename)
# This is necessary to catch an error on Windows for files in a
# directory junction pointing to a symlink whose target is on a
# network drive that is unavailable at startup.
# Fixes spyder-ide/spyder#15714
try:
index = self.has_filename(filename)
except FileNotFoundError:
index = None

if index is not None:
if focus:
self.set_stack_index(index)
Expand Down

0 comments on commit 166ed1f

Please sign in to comment.