Repository: spyder-ide/spyder

Issue:
Error when try to type opening bracket in console
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

When worked in console ipython:
1. Created big list (60k entries)
2. Opened it in variables manager, then closed
3. Tried to get max of list by list_name.max(), got an expected error
4. Try to write max() , but the after written word 'max' opening bracket symbol '(' doesn't appear and the error arises

I have option check mark that shows help about method when opening bracket typed

### Traceback
```python-traceback
  File "C:\Users\Aleksey\Anaconda3\lib\site-packages\spyder\widgets\ipythonconsole\control.py", line 61, in keyPressEvent
    self._key_paren_left(text)
  File "C:\Users\Aleksey\Anaconda3\lib\site-packages\spyder\widgets\ipythonconsole\control.py", line 53, in _key_paren_left
    self.show_object_info(last_obj)
  File "C:\Users\Aleksey\Anaconda3\lib\site-packages\spyder\widgets\mixins.py", line 693, in show_object_info
    self.help.set_object_text(text, ignore_unknown=False)
  File "C:\Users\Aleksey\Anaconda3\lib\site-packages\spyder\plugins\help.py", line 777, in set_object_text
    self.save_history()
  File "C:\Users\Aleksey\Anaconda3\lib\site-packages\spyder\plugins\help.py", line 835, in save_history
    for index in range(self.combo.count())] ))
  File "C:\Users\Aleksey\Anaconda3\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2029' in position 35: character maps to <undefined>
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}
```

## Versions

* Spyder version: 3.3.3 
* Python version: 3.7.1
* Qt version: 5.9.6
* PyQt5 version: 5.9.2
* Operating System: Windows 7

### Dependencies

```
pyflakes >=0.6.0  :  2.0.0 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
sphinx >=0.6.6    :  1.8.2 (OK)
rope >=0.9.4      :  0.11.0 (OK)
jedi >=0.9.0      :  0.13.2 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
pandas >=0.13.1   :  0.23.4 (OK)
numpy >=1.7       :  1.15.4 (OK)
sympy >=0.7.3     :  1.3 (OK)
cython >=0.21     :  0.29.2 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0     :  7.2.0 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.2.2 (OK)
```



Discussion:
Thanks for reporting. We'll fix this error in our next release (3.3.4).

Resolving patch:
diff --git a/spyder/plugins/help.py b/spyder/plugins/help.py
--- a/spyder/plugins/help.py
+++ b/spyder/plugins/help.py
@@ -829,11 +829,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)


Test patch: