I am new to Python scripting and i have one big script for an automation. I am trying to understand how that script is tracing the supplied data. i am not able to trace each and every steps how the flow and what will be value at each step. Is there any way that I can trace each step and what will be the value at that step/after completing that step. Can any one please help me here?
-
1What do you mean by "tracing the supplied data"? Have you tried using break points?Jordan Singer– Jordan Singer2019-01-17 16:51:25 +00:00Commented Jan 17, 2019 at 16:51
-
I mean, I will supply the data to python, how that data is getting changed in each step in python. Can I trace that? How break points will solve this?Sridhar Adurthi– Sridhar Adurthi2019-01-18 19:42:25 +00:00Commented Jan 18, 2019 at 19:42
Add a comment
|
1 Answer
If you want to run your program line-by-line, great tools exist that are called debuggers. You should use python debugger (pdb).
If you use PyCharm, a graphical interface is provided for it and show the variable contents
3 Comments
Sridhar Adurthi
Thank you so much for providing a great tool. I have one question. I have an ansible playbook which will internally call the python script (which I mentioned above) and gets executed and return to ansible playbook again. While calling python, it will pass the values and that values will be used in python script. Can I trace the python alone while ansible playbook supplying the values? May be I am complicating the things here. Please don't mind
WayToDoor
@SridharAdurthi I honestly don't know. Maybe you can print the values from your plybook and run your script in the debugger with these values
Sridhar Adurthi
Thank you. good one. I have started collecting the values from Ansible and trying to recreate in python using pycharm. Helps a lot. Thanks much.