Interacting with the command line

The simplest method is simply passing the name of your program as input. For example, for the pdb_test.py program, this is as follows:

class Pdb_test(object):
def __init__(self, parameter):
self.counter = parameter

def go(self):
for j in range(self.counter):
print ("--->",j)
return

if __name__ == '__main__':
Pdb_test(10).go()

By executing from the command line, pdb loads the source file to be analyzed and stops its execution at the first statement found. In this case, the debug stops at line 1 (that is, at the definition of the Pdb_test class):

python -m pdb pdb_test.py
> .../pdb_test.py(1)<module>()
-> class Pdb_test(object):
(Pdb)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.209.112