Obtain a full program trace with with variable values with Pycharm

已回答

Hi,

 

Is it possible to obtain a full program execution trace with all the variables values with Pycharm in the console or in a file ?

 

thanks

 

Regis

0

Hi Regismaltais! Not sure if I correctly understood your request, could you please provide an example of what do you what to see at the end?

 

You can use Debugger to analyse program execution. Just place a breakpoint on the first line of your script, start a debug session and use Step in button to proceed with program execution step by step. There'll be a variable pane with all local variables available. There is no option to generate any meaningful report for script execution under debugger, if you have any ideas of how it can be done, please feel free to create a feature request in our tracker.

 

Another option for program execution analyse is to use Profiler. It allows to check the call graph and time spent on the different steps of execution.

0
Avatar
Permanently deleted user

Hi,

Instead of adding a huge amount of breakpoint and checking variables states at each step, I will like to know if instead of doing a trace this way, then instead I could  just install a plugin or use a special function that will record program execution variables states into a file by example

 

I know I can use print but also this will be a lot of print to creates to do this job

0

I see, thank you for clarification! Unfortunately there's no such option for now and it's not clear how this output file should be structured for a rather big program to still be human readable. There's no such 3d party plugin as far as I know.

 

You can right click on the breakpoint disable Suspend option, enable Evaluate and log and use such log-breakpoints for tracing. But for a complex logging  functionality it's definitely a better idea to just use logging package from Python standard library in your code.

0

请先登录再写评论。