0

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?

2
  • 1
    What do you mean by "tracing the supplied data"? Have you tried using break points? Commented 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? Commented Jan 18, 2019 at 19:42

1 Answer 1

1

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 contentsPyCharm debugger in action

Sign up to request clarification or add additional context in comments.

3 Comments

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
@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
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.