Skip to content

Error in python extension when launching from terminal #18539

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

Closed
lilithabaddon opened this issue Feb 17, 2022 · 9 comments
Closed

Error in python extension when launching from terminal #18539

lilithabaddon opened this issue Feb 17, 2022 · 9 comments
Assignees

Comments

@lilithabaddon
Copy link

Issue Type: Bug

Behaviour

Expected vs. Actual

When I launch Vscode from my console (cmder/powershell) with the command code . (Inside a python project folder). I have an error in the Python output :

[ERROR 2022-1-17 15:21:11.939]: Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '�[34mD:\Dev\MyProject'
	at Object.readdirSync (fs.js:1021:3)
	at Object.e.readdirSync (electron/js2c/asar_bundle.js:5:10478)
	at c:\Users\me\.vscode\extensions\ms-python.python-2022.0.1814523869\out\client\extension.js:24:259625
	at c:\Users\me\.vscode\extensions\ms-python.python-2022.0.1814523869\out\client\extension.js:24:259776
	at Array.map (<anonymous>)
	at h.initWatchers (c:\Users\me\.vscode\extensions\ms-python.python-2022.0.1814523869\out\client\extension.js:24:259571)
	at async h.ensureWatchersReady (c:\Users\me\.vscode\extensions\ms-python.python-2022.0.1814523869\out\client\extension.js:52:4321)] {
  errno: -4058,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '\x1B[34mD:\\Dev\\MyProject'
}

It seems it add caracters to the folder path (console color caracters ???).

When this error occurs, VSCode use a lot of CPU and PyLance is very slow.

No problem if I open VSCode manualy and open my project.

I'm on Windows 10, VSCode and Python extensions up to date.

Extension version: 2022.0.1814523869
VS Code version: Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326, 2022-02-09T22:02:28.252Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 x 3193)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.94GB (7.28GB free)
Process Argv . --crash-reporter-id 5d214d33-14b8-4151-9615-ac62aa910fb2
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30425749
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30438341
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30433507
vsclayoutctrc:30437038
vsrem710:30416614
dsvsc008:30436278
pythonvspyt640:30436486
vsbas813:30436447
vscscmwlcmt:30438805
helixcf:30438807
vscaac:30438847

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 17, 2022
@karrtikr
Copy link

This is likely a dup of #18459, please try #18459 (comment) and see if it helps.

@lilithabaddon
Copy link
Author

lilithabaddon commented Feb 17, 2022 via email

@lilithabaddon
Copy link
Author

lilithabaddon commented Feb 17, 2022

But effectively, it seems to have a link with poetry too. I've the problem only on folders where I use poetry, if I've a simple venv without poetry, no problem.

After more tests, it seems it only happens with venv create with the config virtualenvs.in-project = true

But why the error appears only when launching from console ???

@karrtikr
Copy link

karrtikr commented Feb 18, 2022

I see, in that case please try Python: Switch to Insiders commands to download the latest insiders build of the extension which has the fix.

But why the error appears only when launching from console ???

It could have something to do with the fact that the console/terminal is color coded. We directly parse the output of poetry commands from terminal, which is why the parsing fails.

@lilithabaddon
Copy link
Author

I switched to insiders daily channel and it seems to work fine with this poetry config.
Thank you

@lilithabaddon
Copy link
Author

How to switch back from insiders ?

@karrtikr
Copy link

Try using the Python: Switch to default channel command. We have #18144 coming soon so you wouldn't have this hassle in the future.

@lilithabaddon
Copy link
Author

Thanks a lot.

I close the issue then.

@karrtikr
Copy link

Happy coding!

@karrtikr karrtikr self-assigned this Feb 18, 2022
@karthiknadig karthiknadig removed the triage-needed Needs assignment to the proper sub-team label Feb 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2022
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

3 participants