Skip to content

Commit

Permalink
Merge from 3.x: PR #8879
Browse files Browse the repository at this point in the history
Fixes #8878
  • Loading branch information
ccordoba12 committed Mar 4, 2019
2 parents 0e3f319 + 1cf7b2c commit 5430c98
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spyder/plugins/help/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,14 @@ def load_history(self, obj=None):

def save_history(self):
"""Save history to a text file in user home directory"""
# Don't fail when saving search history to disk
# See issues 8878 and 6864
try:
open(self.LOG_PATH, 'w').write("\n".join( \
[to_text_string(self.combo.itemText(index))
for index in range(self.combo.count())] ))
except (UnicodeDecodeError, EnvironmentError):
search_history = [to_text_string(self.combo.itemText(index))
for index in range(self.combo.count())]
search_history = '\n'.join(search_history)
open(self.LOG_PATH, 'w').write(search_history)
except (UnicodeEncodeError, UnicodeDecodeError, EnvironmentError):
pass

@Slot(bool)
Expand Down

0 comments on commit 5430c98

Please sign in to comment.