11

Hi I am trying to debug multi processes in python. This below is a portion of where I run multi-processes using Pool

pool = Pool(num_half_logical_cpus)
pool_result_dict = pool.starmap(process_batches, lstListSets)

However, I can't hit any breakpoints. Can anyone guide me to hit those breakpoints I set up?

Thanks!

2 Answers 2

26

Add this option to launch.json will let you debug multiple processes.

"subProcess": true,

Then it will hit the breakpoint then you are able to select which process you want to step through (F10). There will be a list of processes at the lower-left sub-window.

Sign up to request clarification or add additional context in comments.

2 Comments

Please forgive this question if it is dumb, but where is that launch.json file? I am using Visual Studio Community, and there is no launch.json file within my project directory or the Visual Studio installation directory. Every mention I can find online regarding either this error or that file seems to be specific to Visual Studio Code, rather than Visual Studio Community. And I'd prefer to not post a new, nearly-identical question that would just confuse other people searching for the Visual Studio Code answer.
@user3685427 VS Code and Visual Studio (Community) are 2 completely different IDEs. The question was specifically asked for VS Code. The mentioned file resides in .vscode/launch.json in the root of a project in VS Code.
5

Click on "Run and Debug" tab.

Then click "create a launch.json file."

enter image description here

Then click on "Python".

enter image description here

Then click on "Python File" configuration.

enter image description here

VSCode will create a "launch.json" file for you. At this point you will need to add "subProcess": true, as stated here https://stackoverflow.com/a/60529923/6121065

enter image description here

And you are good to go. Now you may debug your code. You may need to tweak the configurations where needed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.