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

Debug with justMyCode=false causes "No such file or directory: /usr/lib/python310.zip" #824

Closed
Artalus opened this issue Jan 17, 2022 · 3 comments

Comments

@Artalus
Copy link

Artalus commented Jan 17, 2022

Issue Type: Bug

Behaviour

Debugging literally a print("hi") file with "justMyCode": false in launch.json

Expected vs. Actual Behaviour

A wild exception appears:

[Errno 2] No such file or directory: '/usr/lib/python310.zip'
  File "/usr/lib/python3.10/genericpath.py", line 19, in exists
    os.stat(path)
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,

Steps to reproduce:

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "hi.py",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/hi.py",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}

This is not a 3.10 specific quirk; I tried installing a python36 package and got a stack with the same meaning:

[Errno 2] No such file or directory: '/home/user/.local/lib/python3.6'
  File "/usr/lib/python3.6/posixpath.py", line 171, in islink
    st = os.lstat(path)
  File "/usr/lib/python3.6/posixpath.py", line 429, in _joinrealpath
    if not islink(newpath):
  File "/usr/lib/python3.6/posixpath.py", line 395, in realpath
    path, ok = _joinrealpath(filename[:0], filename, {})
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)

If I create ~/.local/lib/python3.6/site-packages directory, the stack is exactly the same as for 3.10.

I am pretty sure that about a month or two ago I did not need or even know about justMyCode setting and was debugging just fine.

Peek 2022-01-17 19-14

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.1
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Pylance
User Settings


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: true
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: false
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

insidersChannel: "off"

tensorBoard
• logDirectory: "<placeholder>"

Extension version: 2021.12.1559732655
VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:39:46.686Z)
OS version: Linux x64 5.10.89-1-MANJARO
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (8 x 4061)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 1
Memory (System) 31.30GB (19.52GB free)
Process Argv --no-sandbox --unity-launch
Screen Reader no
VM 0%
DESKTOP_SESSION xfce
XDG_CURRENT_DESKTOP XFCE
XDG_SESSION_DESKTOP xfce
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyl392cf:30422344
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30384385
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscop804:30404766
vs360:30404995
vsrem710cf:30416617
vsccppwtstudy:30421978

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Jan 18, 2022
@fabioz
Copy link
Collaborator

fabioz commented Jan 20, 2022

This isn't really a bug, you're seeing that because you have Raised Exceptions checked and you selected to show any exception even in the standard library (due to the justMyCode:false).

You can just ignore the raised exception and resume the debugger execution (or you can uncheck the Raised Exceptions if you don't want to see those).

@fabioz fabioz closed this as completed Jan 20, 2022
@Artalus
Copy link
Author

Artalus commented Jan 21, 2022

Thanks, that kinda helped, but is there a way to filter "not my code" scope somehow in this regard?
In this case, I am trying to debug the (raised but caught at some point) exception inside third-party library, so I could use something like

{
  "justMyCode": true,
  "justMyCode-except": [
    "/tmp/test/venv310/lib/python3.10/site-packages/somelib/"
  ]
}

@fabioz
Copy link
Collaborator

fabioz commented Jan 21, 2022

Regarding exceptions, unfortunately no (improvements here have already been brought up in #790 but there's no timeline to tackle those).

An alternative may be defining what's considered your own code (when justMyCode: true) with an environment variable:

i.e.: You can define an environment variable: IDE_PROJECT_ROOTS which is a string separated with os.pathsep -- ":" on Linux and ";" on Windows with the folders that you want to consider your own code, although note that this will be regarded for everything then (not just exceptions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants