Skip to content

Commit

Permalink
Merge pull request #15715 from ccordoba12/issue-15714
Browse files Browse the repository at this point in the history
PR: Catch an error when restoring files on Windows (Editor)
  • Loading branch information
ccordoba12 committed May 27, 2021
2 parents d22f459 + 166ed1f commit fd2e0fa
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 fd2e0fa

Please sign in to comment.