Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Handle error when doing a browser history update #7642

Merged
merged 2 commits into from
Aug 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions spyder/widgets/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
QMessageBox, QToolButton, QTreeView, QVBoxLayout,
QWidget)
# Local imports
from spyder.config.base import _
from spyder.config.base import _, get_home_dir
from spyder.py3compat import (str_lower, to_binary_string,
to_text_string)
from spyder.utils import icon_manager as ima
Expand Down Expand Up @@ -1122,9 +1122,13 @@ def go_to_next_directory(self):

def update_history(self, directory):
"""Update browse history"""
directory = osp.abspath(to_text_string(directory))
if directory in self.history:
self.histindex = self.history.index(directory)
try:
directory = osp.abspath(to_text_string(directory))
if directory in self.history:
self.histindex = self.history.index(directory)
except Exception:
user_directory = get_home_dir()
self.chdir(directory=user_directory, browsing_history=True)

def chdir(self, directory=None, browsing_history=False):
"""Set directory as working directory"""
Expand Down