"Go to definition" causes error in Python 3.6
See original GitHub issueDescription
What steps will reproduce the problem?
Any use of “Go to definition” in Windows with Spyder 4.1.5 raises this error.
Traceback
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1440, in handle_go_to_definition
def_range = position['range']
TypeError: list indices must be integers or slices, not str
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\ProgramData\Anaconda3\lib\logging\__init__.py", line 992, in emit
msg = self.format(record)
File "c:\ProgramData\Anaconda3\lib\logging\__init__.py", line 838, in format
return fmt.format(record)
File "c:\ProgramData\Anaconda3\lib\logging\__init__.py", line 575, in format
record.message = record.getMessage()
File "c:\ProgramData\Anaconda3\lib\logging\__init__.py", line 338, in getMessage
msg = msg % self.args
ValueError: incomplete format
Call stack:
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 223, in <module>
main()
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 219, in main
mainwindow.main()
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3651, in main
mainwindow = run_spyder(app, options, args)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3567, in run_spyder
app.exec_()
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\languageserver\client.py", line 497, in on_msg_received
self.req_reply[req_id](None, {'params': []})
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\languageserver\plugin.py", line 549, in receive_response
self.COMPLETION_CLIENT_NAME, req_id, response)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 123, in receive_response
self.howto_send_to_codeeditor(req_id)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 171, in howto_send_to_codeeditor
self.skip_and_send_to_codeeditor(req_id)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 205, in skip_and_send_to_codeeditor
self.gather_and_send_to_codeeditor(request_responses)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\completion\plugin.py", line 273, in gather_and_send_to_codeeditor
response_instance.handle_response(req_type, responses)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1019, in handle_response
handler(params)
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1457, in handle_go_to_definition
"Error when processing go to definition")
File "c:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1050, in log_lsp_handle_errors
logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)
Versions
- Spyder version: 4.1.5
- Python version: 3.6.4
- Qt version: 5.9.6
- PyQt5 version: 5.9.2
- Operating System: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 0.5.2 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.16.1 (OK)
jedi =0.17.1 : 0.17.1 (OK)
nbconvert >=4.0 : 5.6.1 (OK)
numpydoc >=0.6.0 : 0.7.0 (OK)
paramiko >=2.4.0 : 2.4.2 (OK)
parso =0.7.0 : 0.7.0 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.4 (OK)
psutil >=5.3 : 5.7.2 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=1.0 : 1.8.2 (OK)
pyls >=0.34.0;<1.0.0 : 0.34.1 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 0.7.2 (OK)
qtconsole >=4.6.0 : 4.7.6 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.4 (OK)
sphinx >=0.6.6 : 3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 : 1.9.4 (OK)
watchdog : None (OK)
zmq >=17 : 19.0.1 (OK)
# Optional:
cython >=0.21 : 0.27.3 (OK)
matplotlib >=2.0.0 : 2.2.2 (OK)
numpy >=1.7 : 1.18.1 (OK)
pandas >=0.13.1 : 0.24.2 (OK)
scipy >=0.17.0 : 1.4.1 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
variable defined in a class gives an error in Python 3 [duplicate]
This following simple code gives an error in Python 3.6 (but OK in 2.7): class XY: pre = '' z = [pre +...
Read more >8. Errors and Exceptions — Python 3.11.1 documentation
The error is caused by (or at least detected at) the token preceding the arrow: in the example, the error is detected at...
Read more >Built-in Exceptions — Python 3.11.1 documentation
In Python, all exceptions must be instances of a class that derives from BaseException . In a try statement with an except clause...
Read more >What's New In Python 3.6 — Python 3.11.1 documentation
The new PYTHONMALLOC environment variable can now be used to debug the interpreter memory allocation and access errors. Significant improvements in the standard ......
Read more >Exception Handling — Python 3.11.1 documentation
Most C API functions don't clear this on success, but will set it to indicate the cause of the error on failure. Most...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe the issue is with Python 3.6.
@dalthviz, could you try to reproduce this on Windows?
Checking a little bit more seems like an update to jedi 0.17.2 fixes the issues (seems like jedi 0.17.1 has an issue when running under Python 3.6):
I think the issue is related with davidhalter/jedi#1627
With Jedi 0.17.2 everything (as far as I tested) works as expected. Maybe we need to change the Jedi dependency version from =0.17.1 to = 0.17.2 ?