vscode-debugger

Can't pause python process using debug

Can't pause python process using debug Question: I have a python script which starts multiple sub processes using these lines : for elm in elements: t = multiprocessing.Process(target=sub_process,args=[elm]) threads.append(t) t.start() for t in threads: t.join() Sometimes, for some reason the thread halts and the script never finishes. I’m trying to use VSCode debugger to find …

Total answers: 2

VSCode Python Remote Debugging Suddenly Not Working

VSCode Python Remote Debugging Suddenly Not Working Question: Starting a couple days ago my normal process for debugging python code via pytest has just stopped working. My previous process was as follows: Insert the debugpy macro either above the pytest test definition or at the top level of the code being debugged. import debugpy debugpy.listen(5678) …

Total answers: 1

Matplotlib's show function triggering unwanted output

Matplotlib's show function triggering unwanted output Question: Whenever I have any Python code executed via Python v3.10.4 with or without debugging in Visual Studio Code v1.74.2, I get output looking like the following in the Debug Console window in addition to the normal output of the code. Otherwise, all of my Python programs work correctly …

Total answers: 3

VSCode python print object as object not string, similar to node.js

VSCode python print object as object not string, similar to node.js Question: VSCode, node.js script, run with debugger on and a breakpoint on the last line: const obj = { key1: ‘value1’, key2: ‘value2’ }; console.log(obj); console.log(JSON.stringify(obj)); console.log(”); produces this, in the interactive console: note the first output is the object in grey with the …

Total answers: 2

VS Code Debugger Immediately Exits

VS Code Debugger Immediately Exits Question: I use VS Code for a python project but recently whenever I launch the debugger it immediately exits. The debug UI will pop up for half a second then disappear. I can’t hit a breakpoint no matter where it’s placed in the current file. The project has the expected …

Total answers: 1

Python project created using Poetry: how do I debug it in Visual Studio Code?

Python project created using Poetry: how do I debug it in Visual Studio Code? Question: I have a Python project which I created according to basic Poetry instructions. The project folder is something like this: my-project +—-my_project | +– my_project.py | +– File1.py | +– File2.py | +—-pyproject.toml Example of how I import stuff from …

Total answers: 2

How to make VScode launch.json for a Python module

How to make VScode launch.json for a Python module Question: I’m reseaching self-supervised muchine learning code. And I have wanted to debug the code with python debugger not pdb.set_trace(). This is python command for ubuntu terminal. python -m torch.distributed.launch –nproc_per_node=1 main_swav.py –data_path /dataset/imagenet/train –epochs 400 –base_lr 0.6 –final_lr 0.0006 –warmup_epochs 0 –batch_size 8 –size_crops 224 …

Total answers: 2

Running a loop/multiple lines in vs code python debug console

Running a loop/multiple lines in vs code python debug console Question: How do I run a simple loop in VS Code’s python debug console? When I try to enter the following: for el in dataset: It gives me the error below. I seem to be able to enter variable names, but not multi-line commands like …

Total answers: 3