Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

"Unresolved import" for some files in sub-directories in a workspace #1223

Closed
xobs opened this issue Jun 19, 2019 · 8 comments
Closed

"Unresolved import" for some files in sub-directories in a workspace #1223

xobs opened this issue Jun 19, 2019 · 8 comments
Assignees

Comments

@xobs
Copy link

xobs commented Jun 19, 2019

Opening a new issue as recommended from #1099 (comment)

Some Python packages are not able to be read by the Python Language Server. They report "unresolved import", despite the fact that Python is able to read them just fine.

The repository in question is https://github.com/xobs/teardown2019-workshop. It contains submodules, which either get added to a .env file (via python3 lxbuildenv.py > .env) or by manually adding them to the python.autoComplete.extraPaths setting.

python3 is able to see litex_boards.partner.platforms.fomu_evt, however the Python Language Server cannot.

This is running in python.org python3.exe version 3.7.3. There is no virtualenv, venv, conda, pip modules, or anything like that.

The language server version is Microsoft Python Language Server version 0.2.96.0

The line that is giving the error is https://github.com/xobs/teardown2019-workshop/blob/master/workshop.py#L28

An example of the "extraPaths" setting that didn't work is at https://github.com/xobs/teardown2019-workshop/blob/master/workshop.py#L10

@xobs
Copy link
Author

xobs commented Jun 19, 2019

Here is the result of the "trace". python-output.txt

Interestingly, "litex_boards" only appears in the list of search paths, and doesn't appear anywhere else.

@jakebailey
Copy link
Member

Can you give the trace when on the daily build? Should be 0.3.16 at the moment. I changed the way that the search paths are printed to better reflect what we actually use.

@xobs
Copy link
Author

xobs commented Jun 19, 2019

Do you mean the daily python-language-server build? This is running on the daily vscode build:

Version: 1.35.1 (system setup)
Commit: c7d83e57cd18f18026a8162d042843bda1bcf21f
Date: 2019-06-12T14:30:02.622Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134

How can I install the daily pls build?

@jakebailey
Copy link
Member

jakebailey commented Jun 19, 2019

Sorry, I meant the language server daily, not VS Code or the extension. Set:

"python.analysis.downloadChannel": "daily"

And reload to trigger a download. Don't worry if it complains about the option not existing.

@xobs
Copy link
Author

xobs commented Jun 19, 2019

Here is the output from the daily python language server: python-output-daily.txt

@jakebailey
Copy link
Member

Great, thanks. Just wanted to make sure that litex_boards was making it into the user search path list. I'll look at the repo and see what's going on.

@jakebailey
Copy link
Member

Following up on this. Cloned the repo via:

git clone --recurse-submodules https://github.com/xobs/teardown2019-workshop.git

Then did:

python .\litex\lxbuildenv.py -e

To grab a PYTHONPATH line to put in .env, then loaded workshop.py. The only import that appears to be unresolved is lxbuildenv, which would require also adding ./litex to extraPaths or similar, which may then involve #443/#1360/#1700's nesting/naming problems.

image

Is this better than what you had observed?

@jakebailey
Copy link
Member

Without feedback I'm going to close this; I think this was mostly handled except for the above linked issues to do with the single-name problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants