question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError in go-to-definition

See original GitHub issue

Description

What steps will reproduce the problem?

I started Spyder 4b6, import numpy as np, when I ctrl-clicked on np, I got this error message. Plus, the code highligting doesn’t work as expected: import (purpule) numpy (white) as(purple) np (purple), np should have been colored white too.

Traceback

  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1219, in handle_go_to_definition
    def_range = position['range']
TypeError: string indices must be integers

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\logging\__init__.py", line 1034, in emit
    msg = self.format(record)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\logging\__init__.py", line 880, in format
    return fmt.format(record)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\logging\__init__.py", line 619, in format
    record.message = record.getMessage()
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\logging\__init__.py", line 380, in getMessage
    msg = msg % self.args
ValueError: incomplete format
Call stack:
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\app\start.py", line 196, in main
    mainwindow.main()
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\app\mainwindow.py", line 3646, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\app\mainwindow.py", line 3529, in run_spyder
    app.exec_()
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\completion\languageserver\client.py", line 343, in on_msg_received
    handler(resp['result'], req_id)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\completion\languageserver\providers\document.py", line 195, in process_go_to_definition
    {'params': result})
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\completion\languageserver\plugin.py", line 279, in receive_response
    self.COMPLETION_CLIENT_NAME, req_id, response)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\completion\plugin.py", line 138, in receive_response
    self.gather_and_send(request_responses)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\completion\plugin.py", line 189, in gather_and_send
    response_instance.handle_response(req_type, responses)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 915, in handle_response
    handler(params)
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 1236, in handle_go_to_definition
    "Error when processing go to definition")
  File "C:\Users\Amin\Anaconda3\envs\spyder-beta\lib\site-packages\spyder\plugins\editor\widgets\codeeditor.py", line 946, in log_lsp_handle_errors
    logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)

Versions

  • Spyder version: 4.0.0b6
  • Python version: 3.7.3
  • Qt version: 5.12.5
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.5.5            :  4.5.5 (OK)
nbconvert >=4.0              :  5.6.0 (OK)
sphinx >=0.6.6               :  2.2.0 (OK)
pylint >=0.25                :  2.4.2 (OK)
psutil >=0.3                 :  5.6.3 (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.5.0;<2.0.0:  1.5.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                :  None (NOK)
cython >=0.21                :  None (NOK)
IPython >=4.0                :  7.8.0 (OK)
matplotlib >=2.0.0           :  None (NOK)
pandas >=0.13.1              :  None (NOK)
numpy >=1.7                  :  None (NOK)
scipy >=0.17.0               :  None (NOK)
pyls >=0.28.2;<0.29.0        :  0.28.3 (OK)
rtree >=0.8.3                :  0.8.3 (OK)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Oct 16, 2019

Yes with the latest master I can’t reproduce this, but if I use a commit before the merge of the PR #10399 the error raises

Thanks a lot @dalthviz for the extra confirmation!

I’m going to close this one as fixed by PR #10399. The syntax highlighting bug was reported before in #10351.

1reaction
ccordoba12commented, Oct 15, 2019

@dalthviz, please take a look at this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vscode [ctrl+click] 'vue single-file components', 'go to definition ...
I used vue-helper extension, together with volar.
Read more >
Working with JavaScript in Visual Studio Code
VS Code tries to provide project-wide IntelliSense for JavaScript and TypeScript, which is what makes features such as auto-imports and Go to Definition...
Read more >
uncaught typeerror: (0 , react__ ...
On starting the deveopment server, it throws the error : TypeError: react__WEBPACK_IMPORTED_MODULE_0___default (...) is not a function I am a beginner in ...
Read more >
neoclide/coc.nvim - Gitter
If using gd to go to definition, e.g, nmap <silent> gd ... read property 'length' of null TypeError: Cannot read property 'length' of...
Read more >
Announcing TypeScript 4.7 - Microsoft Developer Blogs
This can be helpful in cases where an ordinary Go to Definition command ... let str = `hello ${Symbol()}`; // TypeError: Cannot convert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found