DsCpp
DsCpp

Reputation: 2489

Debug python with vscode from an external script

How can I debug a python program from an external app?
I'm using guildAI which is an external utility, that when running guild run train.py internally it runs python train.py but with other wrappers.
Is there a way, to somehow debug (like remote debugging) with vs code such applications?
I.e tell vs code to run guild run train.py for me? or some other way

Upvotes: 0

Views: 463

Answers (1)

Brett Cannon
Brett Cannon

Reputation: 15990

You want to do what's called "local attach". Basically what you need to do is install ptvsd with your app, call ptvsd.enable_attach() and ptvsd.wait_for_attach(), and then use breakpoint() to cause the debugger to pause upon attach to let you start walking through your app.

Upvotes: 1

Related Questions