Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOTDIR: not a directory, scandir '/opt/spark/python/lib/py4j-0.10.9-src.zip' #1021

Closed
pebabion opened this issue Mar 8, 2021 · 8 comments
Closed
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@pebabion
Copy link

pebabion commented Mar 8, 2021

Environment data

  • Language Server version: 2021.3.0
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: undefined
  • python.analysis.typeCheckingMode: off

Expected behaviour

I have this error thrown back from Pylance and I have no understanding why it is happening.
In .bashrc, I do have this line (needed to run Spark).

export PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.9-src.zip:$PYTHONPATH

Actual behaviour

Pylance is tell me that there is an error ENOTDIR.

Logs

Python Language Server Log

[Error - 2:56:42 pm] An internal error occurred while parsing file "/home/kelvin/projects/deployments/telkom/tests/test_impact_analysis.py": Error: ENOTDIR: not a directory, scandir '/opt/spark/python/lib/py4j-0.10.9-src.zip'
    at Object.readdirSync (fs.js:959:3)
    at Object.readdirSync (electron/js2c/asar_bundle.js:5:10231)
    at h.readdirEntriesSync (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/common/fileSystem.ts:135:19)
    at t.PyrightFileSystem.processPartialStubPackages (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/pyrightFileSystem.ts:150:46)
    at _0x419dcf._ensurePartialStubPackages (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/analyzer/importResolver.ts:773:25)
    at _0x419dcf.resolveImport (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/analyzer/importResolver.ts:119:14)
    at t.SourceFile._resolveImports (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/analyzer/sourceFile.ts:1070:77)
    at callback (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/analyzer/sourceFile.ts:556:47)
    at i.timeOperation (/home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/common/timing.ts:40:20)
    at /home/kelvin/.vscode/extensions/ms-python.vscode-pylance-2021.3.0/dist/pyright-internal/src/analyzer/sourceFile.ts:555:48

Code Snippet / Additional information

XXX
@github-actions github-actions bot added the triage label Mar 8, 2021
@erictraut
Copy link
Contributor

Thanks for the bug report. I see the cause of the error. It's a bug that was introduced in the last release.

@heejaechang, this is in the new partial stub virtual file system code. The function processPartialStubPackages is verifying that the path exists, but it's not verifying that it's a directory before calling readdirEntriesSync.

@erictraut erictraut added bug Something isn't working and removed triage labels Mar 8, 2021
@erictraut
Copy link
Contributor

This will be fixed in the next release.

@erictraut erictraut added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Mar 8, 2021
@pebabion
Copy link
Author

pebabion commented Mar 8, 2021

@erictraut thanks a lot for the quick response.

May I know when the next release is going to be?

In the meantime, I've reverted back to jedi to avoid the error

@erictraut
Copy link
Contributor

We typically release a new version of Pylance each week on Wednesday.

@pebabion
Copy link
Author

pebabion commented Mar 8, 2021

Many thanks!

@heejaechang
Copy link
Contributor

@erictraut thank you for taking care of it. I wrongly assumed all paths given will be a directory.

@jakebailey
Copy link
Member

Note that fix doesn't actually go and make zip files work; that'd be another enhancement to consider. We implemented it in MPLS (and likely via the VFS abstraction we can again; zip files are random accessable).

@jakebailey
Copy link
Member

This issue has been fixed in version 2021.3.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202131-10-march-2021

If you need support for zip files specifically, we'd appreciate a new issue so we can take note of the enhancement request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants