Closed xboxone08 closed 4 years ago
I fail to understand how this is related to this extension. Perhaps you mistook this for the vscode python extension?
Would you mind sending me a reproduction case?
No, I tried running it with no extensions, and it worked. I tried it with only the vscode python extension, and it worked again. Then I tried running it with only this extension, and it gave the error.
Alright. Again, would you mind sending me a reproduction case? Without providing code or more details it's very hard for me to figure out what the problem is in your situation.
@Whinarn Just create two Python 3 files where one imports the other and they are in the same directory. There shouldn't be a virtual environment or init.py. I'm sorry, I might have confused you by saying the I ran the script, I wrote that on accident. I underlines it with a squiggly line and says:
unresolved import
errors
Here's the thing. This extension only ever touches the settings.json
file inside your .vscode
directory at the root of your vscode project. If you don't have a virtual environment, this extension does nothing, and should not affect anything.
I did try without the __init__.py
file and get linting errors from pylint
not being able to import from the local package, but with __init__.py
it worked fine. This was regardless of Python Auto Venv
being enabled in the workspace or not.
I suggest you to look into your vscode configuration and pylint
in particular.
Some suggestions: https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#unresolved-import-warnings https://github.com/microsoft/python-language-server/issues/1994 https://github.com/microsoft/vscode-python/issues/3840 https://stackoverflow.com/questions/43574995/visual-studio-code-pylint-unable-to-import-protorpc https://stackoverflow.com/questions/48024049/pylint-raises-error-if-directory-doesnt-contain-init-py-file
It appears as if the __init__.py
file is still necessary by pylint
even though Python 3.3+ no longer requires it, when pylint
is set to scan a single file rather than a directory (which happens in vscode). So I think you should add back your __init__.py
file for this to work, or disable pylint
linting in vscode.
I hope this helps.
I'll close this issue since it has nothing to do with this extension. Feel free to open it if I'm wrong. But if you do, zip a project that reproduces this, and be sure that it actually works without this extension installed. Because so far there's nothing that points to issues with this extension.
Thanks!
Issue Type: Bug
I have a file called
errors.py
in the same directory as mymain.pyw
file, andmain
importserror
. Visual Studio Code (and PyCharm) saysunresolved import 'errors'
. Importing any file results in the same message.Extension version: 1.1.1 VS Code version: Code 1.48.2 (a0479759d6e9ea56afa657e454193f72aef85bd0, 2020-08-25T10:13:11.295Z) OS version: Windows_NT x64 10.0.19041