In preamble, please note I’m a very new user in VScode.
In a current project i’m involved, the workflow is more of less the following one:
- A main bash script is run to load modules and specific variables
- The previous script loads a “main.py” python file: its role is to chain different external softs and python codes
- The external softs ask as well python scripts on his own
The script is run in a remote server (under Linux os whereas i’m under Windows one), but now difficulty now on this topic.
I’m using the Python debugger “attach” and i’m facing the current difficulty
- if the first break point is set in the “main.py” file, it’s ok; i can add another ones in the same file tu use continue and so on
- however if i add a breakpoint in another python file (python file (2) here after) using either vscode idle (red point) or even a “debugpy.breakpoint()”, it is simply bypassed
- if my first breakpoint is set to python file 2, the debugging stops BUT it is waiting for the debugger attach (i’ve no control to run it)
1rst breakpoint add:
import debugpy
debugpy.listen(5678)
print("Waiting for debugger attach")
debugpy.wait_for_client()
debugpy.breakpoint()
i guess i should additional information, but which ones ? what am i missing
To summary the program workflow:
bash script ------> main.py ----------> external soft1 ----> etc
| |
| |
external soft2 python file (2)
Thanks
Paul
######################################################################
UPDATE
######################################################################
I’ve made a basic example that should reproduce the issue (breakpoints are also missied) – note the main advantage here it prints some information’s i missed in my real program.
The example is composed of 4 files:
- 2 bash files
- 2 python files
In practice, type "sh start.sh"
- File 1: start.sh
#!/bin/bash
python test_breakpoint.py
- File 2: run_python.sh
#!/bin/bash
python inside_file.py
- File 3: test_breakpoint.py
import os, subprocess, debugpy
path = os.getcwd()
shfile = "run_python.sh"
# /// DEBUGGING
debugpy.listen(5678)
print("Waiting for Python debugger: attach")
debugpy.wait_for_client()
debugpy.breakpoint()
# /// DEBUGGING
command_line = f"sh {shfile}"
args = command_line.split()
run = subprocess.run(args)
- File 4: inside_file.py
import debugpy
print("n*** here is a breakpoint ***n")
debugpy.breakpoint()
- the launch.json file is:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Attach",
"type": "debugpy",
"request": "attach",
"port": 5678,
"host": "localhost",
"justMyCode": true,
"pythonArgs": [
"-Xfrozen_modules=off"
],
"env": {
"PYDEVD_DISABLE_FILE_VALIDATION": "1"
}
}
]
}
Whatever I implement, the following warning appears and any breakpoint ouside the main python file (test_breakpoint.py here) is ignored …
… what am i missing?
Thanks for your help
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.
Waiting for Python debugger: attach*** here is a breakpoint ***
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.