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" on module takes you to __init__.py instead of actual module

See original GitHub issue

Environment data

  • VS Code version: 1.29.1
  • Extension version (available under the Extensions sidebar): 2018.11.0
  • OS and version: Windows 10 64-bit
  • Python version (& distribution if applicable, e.g. Anaconda): Conda 3.7.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: None

Actual behavior

“Go to definition” on module takes me to __init__.py rather than the module I actually selected.

Expected behavior

“Go to definition” on module takes me to the module I selected.

Steps to reproduce:

Using the jedi language engine:

gotodef_debug

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

# there is no output, as seen in the screencap above

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

# there is no output, as seen in the screencap above

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
DonJayamannecommented, Jan 31, 2019

Unable to replicate in the latest version of Jedi and parso, hence we should upgrade.

1reaction
fredrikaverpilcommented, Dec 21, 2019

@brettcannon I cannot reproduce this anymore in vscode 1.41.1. To me, this issue seems completely fixed. I’ve tested the same case as above with both jedi and the python language server! 👍 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - What is __init__.py for? - Stack Overflow
When a regular package is imported, this __init__.py file is implicitly executed, and the objects it defines are bound to names in the...
Read more >
Understanding Python imports, __init__.py and pythonpath
The python interpreter tries to look for the directory containing the module we are trying to import in sys.path . It is a...
Read more >
6. Modules — Python 3.11.1 documentation
A module is a file containing Python definitions and statements. ... use your favorite text editor to create a file called fibo.py in...
Read more >
How to create a Python Package with __init__.py
Use the interactive interpreter (The REPL) to import the modules and see if you are getting what you expect. · Start your script...
Read more >
Package Initialization - Real Python
If a file named __init__.py is present in a package directory, it's going to be ... Python Modules and Packages: An Introduction ......
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