Skip to content

[QUESTION] How to attach python debugger properly ? #264

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
BriceBoy opened this issue Jun 11, 2024 · 5 comments
Closed

[QUESTION] How to attach python debugger properly ? #264

BriceBoy opened this issue Jun 11, 2024 · 5 comments
Labels
question Further information is requested

Comments

@BriceBoy
Copy link

I would like to know how to configure python debugger properly. Before, I could just debug tests and use breakpoints in python code but I can't seem to do it properly. When it hits a breakpoint it does not open the file the breakpoint is in and I can't see variables values.

I can see that it's stopped on a breakpoint :
image

If I go to the file it's stopped in, I can't seem to see variables values :
image

Here is my actual configuration

"launch": {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "RobotCode: Run Current",
                "type": "robotcode",
                "request": "launch",
                "cwd": "${workspaceFolder}",
                "target": "${file}"
            },
            {
                "name": "RobotCode: Run All",
                "type": "robotcode",
                "request": "launch",
                "cwd": "${workspaceFolder}",
                "target": "."
            },
            {
                "name": "RobotCode: Default",
                "type": "robotcode",
                "request": "launch",
                "purpose": "default",
                "presentation": {
                    "hidden": true
                },
                "attachPython": true,
                "pythonConfiguration": "RobotCode: Python",
                "args": [
                    "--debugFile", "debug",
                    "--loglevel", "TRACE"
                ],
            },
            {
                "name": "RobotCode: Python",
                "type": "debugpy",
                "request": "attach",
                "presentation": {
                    "hidden": true
                },
                "justMyCode": false,
            }
        ]
    }
  • VS Code Version 1.90.0
  • RobotCode Version 0.83.1
  • OS: Windows
  • Python Version 3.12.2
  • RobotFramework Version 7.0
@BriceBoy BriceBoy added the question Further information is requested label Jun 11, 2024
@d-biehl
Copy link
Member

d-biehl commented Jun 11, 2024

Normally you don't need a launch.config, just search for robotcode.debug.attachPython in VSCode settings an enable it. If you want debug also python system libraries or python libraries that are not part of the workspace, enable the debugpy.debugJustMyCode setting.

@BriceBoy
Copy link
Author

Thank you for your time !

Apparently you are right I don't need the launch config but if I can remember right I made it to use breakpoints correctly. Maybe I'm wrong. However the debugger still doesn't open file in which breakpoint is set when it reaches it.

@BriceBoy
Copy link
Author

I just saw this, it might be related to my problem :

0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.

@BriceBoy
Copy link
Author

I finally found the solution to my problem, I downgraded to VSCode v1.89.1 (Python Debugger Issue)

@d-biehl
Copy link
Member

d-biehl commented Jun 11, 2024

very good! Thanks for the info!

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

No branches or pull requests

2 participants