Spyder: Spyder encounters internal error on hover (TypeError / ValueError)

Created on 18 Nov 2019  路  4Comments  路  Source: spyder-ide/spyder

Problem Description

Internal error happens upon clicking one of functions

What steps reproduce the problem?

  1. Launch Spyder.exe
  2. Open Copilot and enable docs to follow cursor (if it's not)
  3. Open kite_tutorial.py
  4. Put cursor to pretty_print(obj, indent=4)

What is the expected output? What do you see instead?

Expected to see no error

Traceback/Error


--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1217, in handle_hover_response
    at_point=self._last_point)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\widgets\mixins.py", line 634, in show_hint
    inspect_word=inspect_word)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\widgets\mixins.py", line 474, in _check_signature_and_format
    name_plus_char = inspect_word + open_func_char
TypeError: can only concatenate tuple (not "str") to tuple

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\mOSt\Anaconda3\lib\logging\__init__.py", line 1034, in emit
    msg = self.format(record)
  File "C:\Users\mOSt\Anaconda3\lib\logging\__init__.py", line 880, in format
    return fmt.format(record)
  File "C:\Users\mOSt\Anaconda3\lib\logging\__init__.py", line 619, in format
    record.message = record.getMessage()
  File "C:\Users\mOSt\Anaconda3\lib\logging\__init__.py", line 380, in getMessage
    msg = msg % self.args
ValueError: incomplete format
Call stack:
  File "C:\Users\mOSt\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\app\start.py", line 205, in main
    mainwindow.main()
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3716, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3598, in run_spyder
    app.exec_()
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\languageserver\client.py", line 349, in on_msg_received
    handler(resp['result'], req_id)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\languageserver\providers\document.py", line 169, in process_hover_result
    {'params': contents})
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\languageserver\plugin.py", line 284, in receive_response
    self.COMPLETION_CLIENT_NAME, req_id, response)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 120, in receive_response
    self._maybe_send_locked(req_id)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 161, in _maybe_send_locked
    send()
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 143, in send
    self.gather_and_send(request_responses)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 212, in gather_and_send
    response_instance.handle_response(req_type, responses)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 921, in handle_response
    handler(params)
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1224, in handle_hover_response
    self.log_lsp_handle_errors("Error when processing hover")
  File "C:\Users\mOSt\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 952, in log_lsp_handle_errors
    logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)

Versions

  • Spyder version: 4.0.0rc2
  • Python version: 3.6.1
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 7, x64

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
sphinx >=0.6.6               :  2.2.1 (OK)
pylint >=0.25                :  2.4.4 (OK)
psutil >=0.3                 :  5.6.5 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.8.0;<2.0.0:  1.8.0 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  1.4 (OK)
cython >=0.21                :  0.29.13 (OK)
IPython >=4.0                :  7.9.0 (OK)
matplotlib >=2.0.0           :  3.1.1 (OK)
pandas >=0.13.1              :  0.25.3 (OK)
numpy >=1.7                  :  1.17.3 (OK)
scipy >=0.17.0               :  1.3.1 (OK)
pyls >=0.31.0;<0.32.0        :  0.31.0 (OK)
rtree >=0.8.3                :  0.8.3 (OK)

Code Completion Bug

All 4 comments

@dalthviz, please take a look at this one.

Thanks for reporting. This is very serious and we'll try to fix ASAP.

FYI in my testing with Kite not installed, simply hovering over any callable on rc2 results in the error; hovering over objects and modules appears not to. In normal usage, this typically occurs once every 60 seconds or more even without intending to hover. FYI, for users reading this issue, you can temporarily disable hover hints in Completion and Linting ---> Introspection ---> Enable hover hints in Spyder's preferences, which prevents the error from occurring.

just ran the current dev version in debug mode and reached the same point. Variable _inspect_word_ seems to have changed from being a string to now being a 1-element tuple. I must say I am not aware why this was changed but a workaround might be to add a type-check in ...\spyder-master\spyder\widgets\mixins.py, line 473 ff::

if has_signature:
    if isinstance(inspect_word, tuple):
        inspect_word = inspect_word[0]
    name_plus_char = inspect_word + open_func_char

(191122) after running Spyder for a day's work with the above lines of code included, the issue did not appear again.

Was this page helpful?
0 / 5 - 0 ratings