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.

Import "test" could not be resolved

See original GitHub issue

coc-pyright is unable to resolve imports when importing a local file, such as

# main.py
from test import *

(both main.py and test.py are in the same directory)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
rodorgascommented, Dec 6, 2020

I had the same issue. Since I was working in a subdirectory of an git repository, it seems that CoC will consider that parent dir was the root. Solved by following instructions here: https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders

3reactions
0xMHcommented, Jun 29, 2021

@rodorgas Is there a way to set the current directory as a root? That’ll help a lot when working on mono repos.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"pytest" is not accessed / Import "pytest" could not be resolved ...
So I'm using pylance and pipenv as my shell. I have pytest installed in my local env, I can run pytest from the...
Read more >
How to fix Import could not be resolved from source Pylance
How to fix Import could not be resolved from source Pylance in this video tutorial I'll teach you how can you solve your...
Read more >
Import could not be resolved [Pylance] : r/vscode - Reddit
14 votes, 12 comments. I'm trying to use torch in a python script but even though it's pip installed, pylance doesn't recognize it…...
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
Python here can be any module. Here's an error when I try to import a numpys module that cannot be found: import numpys...
Read more >
Import "requests" could not be resolved from source Pylance
Encountered error in Visual Studio Code (on Windows machine) while writing first line of a program which was "import requests".
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