+ 1

How to debug decorator method

Hi We all know function goes inside function by using f11 on visual studio. How can we debug decorator code in python if we don't put directly a break point in decorator function?

23rd Sep 2024, 3:56 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 ответов
0
You can use the `pdb.set_trace()` function inside the decorator code where you want to start debugging.
27th Sep 2024, 2:45 AM
`ₕₜₜየ⁴⁰⁶
`ₕₜₜየ⁴⁰⁶ - avatar
0
Do you mean pdb.set_trace() should be first line in my main function? For example, Myfunc(): is decorated by @mydecorator. Hence, set_trace should be first line in myfunc and it would suggest the path of mydecorator ?
28th Sep 2024, 9:34 AM
Ketan Lalcheta
Ketan Lalcheta - avatar