Skip to content

Internal FileNotFoundError error when using autoReload with a drive directly in the watch list #770

@john-aws

Description

@john-aws

Environment data

  • VS Code version: 1.61.2
  • Extension version (available under the Extensions sidebar): v2021.10.1365161279
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Default

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

Clicking Debug Python File in Terminal would run my Python script cleanly.

Actual behaviour

Debugging works fine, but the Python Debug Console shows an internal FileNotFoundError error in the extension/pydev, per below. This specifically happens when I am working with Python source code on a subst'd drive (S: which is a subst of a local OneDrive folder). If, instead of opening folder S:, I open the real, underlying folder that is subst'd to S: (and that real folder is beneath C:\Users\xxxx\OneDrive\Documents\xyz) then everything works cleanly. The problem is only apparent when on the subst'd drive.

S:\> cmd /C "C:\Users\xxxx\AppData\Local\Microsoft\WindowsApps\python3.9.exe c:\Users\xxxx\.vscode\extensions\ms-python.python-2021.10.1365161279\pythonFiles\lib\python\debugpy\launcher 58255 -- s:\69723661.py "
pydev debugger: critical: unable to get real case for file. Details:
filename: s:\
drive: S:\
parts: ['']
(please create a ticket in the tracker to address this).
Traceback (most recent call last):
  File "c:\Users\xxxx\.vscode\extensions\ms-python.python-2021.10.1365161279\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 221, in _get_path_with_real_case
    return _resolve_listing(drive, iter(parts))
  File "c:\Users\xxxx\.vscode\extensions\ms-python.python-2021.10.1365161279\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd_file_utils.py", line 192, in _resolve_listing
    raise FileNotFoundError('Unable to find: %s in %s' % (
FileNotFoundError: Unable to find:  in S:\

During handling of the above exception, another exception occurred:

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create a new folder on your C: drive e.g. c:\users\me\testing
  2. Add a sample Python script to that folder
  3. Open the folder in VS Code, then open the sample Python script
  4. Click Debug Python File in Terminal, result is (hopefully) a clean run and the Python Debug Console output appears normal
  5. Use the Windows subst utility to map S: to c:\users\me\testing
  6. Open the S:\ folder in VS Code, then open the (same) sample Python script
  7. Click Debug Python File in Terminal, this time the resulting Python Debug Console output should include an exception similar to that shown above

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonSurveyNotificationcf'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'pythonDeprecatePythonPath'
User belongs to experiment group 'pythonSortEnvs'
User belongs to experiment group 'pythonRunFailedTestsButtonDisplayed'
User belongs to experiment group 'pythonRefreshTestsButtonDisplayed'
User belongs to experiment group 'pythonRememberDebugConfig'
> conda info --json
> ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe ~\.vscode\extensions\ms-python.python-2021.10.1365161279\pythonFiles\interpreterInfo.py
> ~\.anaconda\Scripts\conda.exe info --json
> ~\.conda\Scripts\conda.exe info --json
> ~\.condarc\Scripts\conda.exe info --json
Python interpreter path: ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe
Starting Microsoft Python language server.
> conda --version
> ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe -m black --diff --quiet s:\69723661.py.297d2e6504dc26c5cfee95a8a0b60256.tmp
cwd: s:\
> ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe -m black --diff --quiet s:\69723661.py.297d2e6504dc26c5cfee95a8a0b60256.tmp
cwd: s:\
> ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe -m black --diff --quiet s:\69723661.py.297d2e6504dc26c5cfee95a8a0b60256.tmp
cwd: s:\
> ~\AppData\Local\Microsoft\WindowsApps\python3.9.exe -m black --diff --quiet s:\69723661.py.297d2e6504dc26c5cfee95a8a0b60256.tmp
cwd: s:\

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions