Spyder: IndexError when processing completions

Created on 17 Sep 2019  路  8Comments  路  Source: spyder-ide/spyder

Description

No completions are shown when I type t at plt.plo$.

What steps will reproduce the problem?

I can repro it consistently after writing this code:

import numpy as np
import matplotlib.pyplot as plt

my_x = np.linspace(1, -1, 1, endpoint=bool)
my_y = np.linspace()
my_x = np.linspace(1, -1, 2)

plt.plot()

Traceback

  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1126, in process_signatures
    parameter_data = parameters[parameter_idx]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 1025, in emit
    msg = self.format(record)
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 869, in format
    return fmt.format(record)
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 608, in format
    record.message = record.getMessage()
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args
ValueError: incomplete format
Call stack:
  File "bootstrap.py", line 186, in <module>
    start.main()
  File "/Users/patricklung/spyder/spyder/app/start.py", line 195, in main
    mainwindow.main()
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3596, in main
    mainwindow = run_spyder(app, options, args)
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3479, in run_spyder
    app.exec_()
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3044, in show_preferences
    dlg.exec_()
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/client.py", line 340, in on_msg_received
    handler(resp['result'], req_id)
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/providers/document.py", line 132, in process_signature_completion
    {'params': response})
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/plugin.py", line 245, in receive_response
    self.COMPLETION_CLIENT_NAME, req_id, response)
  File "/Users/patricklung/spyder/spyder/plugins/completion/plugin.py", line 102, in receive_response
    completion_source, response_instance, req_type, req_id)
  File "/Users/patricklung/spyder/spyder/plugins/completion/plugin.py", line 167, in gather_and_send
    response_instance.handle_response(req_type, responses)
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 886, in handle_response
    handler(params)
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1143, in process_signatures
    self.log_lsp_handle_errors("Error when processing signature")
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 917, in log_lsp_handle_errors
    logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)
--- Logging error ---
Traceback (most recent call last):
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1126, in process_signatures
    parameter_data = parameters[parameter_idx]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 1025, in emit
    msg = self.format(record)
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 869, in format
    return fmt.format(record)
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 608, in format
    record.message = record.getMessage()
  File "/Users/patricklung/anaconda3/envs/spyder-dev/lib/python3.7/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args
ValueError: incomplete format
Call stack:
  File "bootstrap.py", line 186, in <module>
    start.main()
  File "/Users/patricklung/spyder/spyder/app/start.py", line 195, in main
    mainwindow.main()
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3596, in main
    mainwindow = run_spyder(app, options, args)
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3479, in run_spyder
    app.exec_()
  File "/Users/patricklung/spyder/spyder/app/mainwindow.py", line 3044, in show_preferences
    dlg.exec_()
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/client.py", line 340, in on_msg_received
    handler(resp['result'], req_id)
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/providers/document.py", line 132, in process_signature_completion
    {'params': response})
  File "/Users/patricklung/spyder/spyder/plugins/completion/languageserver/plugin.py", line 245, in receive_response
    self.COMPLETION_CLIENT_NAME, req_id, response)
  File "/Users/patricklung/spyder/spyder/plugins/completion/plugin.py", line 102, in receive_response
    completion_source, response_instance, req_type, req_id)
  File "/Users/patricklung/spyder/spyder/plugins/completion/plugin.py", line 167, in gather_and_send
    response_instance.handle_response(req_type, responses)
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 886, in handle_response
    handler(params)
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1143, in process_signatures
    self.log_lsp_handle_errors("Error when processing signature")
  File "/Users/patricklung/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 917, in log_lsp_handle_errors
    logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)

Versions

  • Spyder version: 4.0.0.dev0 11611776d
  • Python version: 3.7.4
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Darwin 18.6.0

Dependencies

pygments >=2.0    :  2.4.2 (OK)
qdarkstyle >=2.6.4:  2.7 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
psutil >=0.3      :  5.6.3 (OK)
pyls >=0.27.0     :  0.28.3 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  None (NOK)
numpy >=1.7       :  None (NOK)
pympler >=0.7     :  None (NOK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.5.5 :  4.5.5 (OK)
IPython >=4.0     :  7.8.0 (OK)
matplotlib >=2.0.0:  None (NOK)
pylint >=0.25     :  2.3.1 (OK)
Code Completion Bug

Most helpful comment

I cannot repro this issue anymore. If I see it in the future, I'll record a GIF.

All 8 comments

Thanks for the reproducible case. @dalthviz, please take a look at this one.

@ccordoba12 @plungg I was not able to reproduce this on Windows and Linux (Fedora). @plungg could you try to reproduce this with the latest master please? Maybe this is some how related with the fix made at PR https://github.com/spyder-ide/spyder/pull/10216?

Also, while testing this I experienced some other issues related with code snippets. @ccordoba12 should I create an unique issue explaining all of these issues or maybe should I create individual issues?

@dalthviz, please post the issues you found about snippets on issue #10230.

@dalthviz, please also try to reproduce this one by checking out beta5 and trying again. I just want to confirm that it's fixed in master.

I was not able to get the same IndexError as @plungg (even when testing with commit https://github.com/spyder-ide/spyder/commit/11611776d89aec8c76e03a44e6ab8cd7a6248024 )

All the other issues found are at https://github.com/spyder-ide/spyder/issues/10230#issuecomment-532366012

I can't reproduce this either with a default configuration.

@plungg, could you post an animated gif of this problem?

I cannot repro this issue anymore. If I see it in the future, I'll record a GIF.

@plungg, I'm going to close this for now but please add more comments here if you manage to reproduce this problem.

Was this page helpful?
0 / 5 - 0 ratings