WhimsicalWhale
WhimsicalWhale

Reputation: 125

VSCode Debugger FileNotFoundError

I currently have a few .py and .ipynb files stored on a Google Drive (G:) to access across my devices. When converting a .ipynb file to .py then running the debugger in VSCode, I sometimes get the issue below:

Microsoft Windows [Version 10.0.19043.1052]
(c) Microsoft Corporation. All rights reserved.

G:\My Drive\Code & Programming>C:/Users/Admin/Anaconda3/Scripts/activate

(base) G:\My Drive\Code & Programming>conda activate base

(base) G:\My Drive\Code & Programming> cmd /C "C:\Users\Admin\Anaconda3\python.exe c:\Users\Admin\.vscode\extensions\ms-python.python-2021.5.926500501\pythonFiles\lib\python\debugpy\launcher 58376 -- "g:\My Drive\<dir1>\test.py" "
pydev debugger: critical: unable to get real case for file. Details:
filename: g:\
drive: G:\
parts: ['']
(please create a ticket in the tracker to address this).
Traceback (most recent call last):
  File "c:\Users\Admin\.vscode\extensions\ms-python.python-2021.5.926500501\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\Admin\.vscode\extensions\ms-python.python-2021.5.926500501\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 G:\

During handling of the above exception, another exception occurred:

However, if I were save the .py file to a different G:\ directory, the debugger runs:

Microsoft Windows [Version 10.0.19043.1052]
(c) Microsoft Corporation. All rights reserved.

G:\My Drive\Code & Programming>C:/Users/Admin/Anaconda3/Scripts/activate

(base) G:\My Drive\Code & Programming>conda activate base

(base) G:\My Drive\Code & Programming> cmd /C "C:\Users\Admin\Anaconda3\python.exe c:\Users\Admin\.vscode\extensions\ms-python.python-2021.5.926500501\pythonFiles\lib\python\debugpy\launcher 53852 -- "g:\My Drive\<dir2>\test.py" "

The error doesn't seem to really provide too much information as to why it's failing for the test.py file in dir1 but not dir2.

Thanks!

Upvotes: 1

Views: 989

Answers (1)

StarshipladDev
StarshipladDev

Reputation: 1145

Visual Studio, along with other widespread IDEs, read a lot of directory locations as command line commands.

For this reason, it is important to remove special characters used in command lines (such a - used for flags, or s which separate commands).

As you had stated in your reply to your comment, removing the spaces for one of your directories resolved the issue.

There is no comprehensive guide to this as it is on a IDE/system by system basis but This Winodws Guide should be a good start.

All the best!

Upvotes: 1

Related Questions