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.

Go to definition in editor not working for files in user PYTHONPATH

See original GitHub issue

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

The “Go to definition” feature in the editor context menu, or CTRL+G, does not work on files that are in my own PYTHONPATH. It does however work on installed libraries and files I place myself in site-packages (on windows with Anaconda \AppData\Local\Continuum\anaconda3\Lib\site-packages).

What steps reproduce the problem?

  1. Create a file “myfileinpythonpath.py” with a method mymethod(), place it in a PYTHONPATH included path
  2. “from myfileinpythonpath import mymethod” works, but I can not use Go to definition to access the file/method
  3. Works as expected (opens the .py file) if I place the file in site-packages or try on another library, for example “import pathlib” and use Go to definition on pathlib

Versions

  • Spyder version: 4.0.0rc1 (same problem also in b7)
  • Python version: 3.7.4 64-bit
  • Qt version: Qt 5.12.5
  • PyQt version: PyQt5 5.12.3
  • Operating System name/version: Windows 10

Running Kite if that matters.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ccordoba12commented, Nov 8, 2019

@goanpeca is working on this right now. It should be ready next week.

0reactions
fazelehhcommented, Apr 28, 2022

I have the same problem with the updated version of spyder. I am using spyder 5.3.0 :

Name Version Build Channel pyls-spyder 0.4.0 pyhd8ed1ab_0 conda-forge spyder 5.3.0 py39hcbf5309_0 conda-forge spyder-kernels 2.3.0 py39hcbf5309_0 conda-forge

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code "Go To Definition" only works within the ...
I'm having some issues with the "Go To Definition" feature in Visual Studio Code and Python code. To note, I haven't tested with...
Read more >
How Python search paths are applied - Visual Studio (Windows)
With typical Python usage, the PYTHONPATH environment variable (or IRONPYTHONPATH , etc.) provides the default search path for module files.
Read more >
Editing Python in Visual Studio Code
Go to Definition (F12) jumps from your code into the code that defines an object. This command is helpful when you're working with...
Read more >
Advanced Visual Studio Code for Python Developers
As a Python developer, a lot of the commands you'll use in Visual Studio Code are ... Open the Keyboard Shortcuts editor by...
Read more >
Using PYTHONPATH — Functional MRI methods
Open Terminal.app ; · Open the file ~/.bash_profile in your text editor – e.g. atom ~/.bash_profile ; · Add the following line to...
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