Azure dev spaces to debug python code running in kubernetes pod Azure dev spaces to debug python code running in kubernetes pod kubernetes kubernetes

Azure dev spaces to debug python code running in kubernetes pod


Debugging should be similar just like we have it in Dot net core.In dot net , we used to debug something like this

Setting and using breakpoints for debugging

If Visual Studio 2017 is still connected to your dev space, click the stop button. Open Controllers/HomeController.cs and click somewhere on line 20 to put your cursor there. To set a breakpoint hit F9 or click Debug then Toggle Breakpoint. To start your service in debugging mode in your dev space, hit F5 or click Debug then Start Debugging.

Open your service in a browser and notice no message is displayed. Return to Visual Studio 2017 and observe line 20 is highlighted. The breakpoint you set has paused the service at line 20. To resume the service, hit F5 or click Debug then Continue. Return to your browser and notice the message is now displayed.

While running your service in Kubernetes with a debugger attached, you have full access to debug information such as the call stack, local variables, and exception information.

Remove the breakpoint by putting your cursor on line 20 in Controllers/HomeController.cs and hitting F9.

Try something like this and see if it works.

Here is an article which explains debugging python code in visual studio 2017

https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-04-debugging?view=vs-2017

Hope it helps.


Currently debugging in Azure Dev Spaces only lists Node.js, .NET Core, and Java as officially supported. The documentation for how to debug these 3 types of environments was written pretty recently (Quickstarts published on 7/7/2019). I am assuming that a guide for Python should be on the way shortly, but I have been unable to find any published timeline for this.