Run the script as follows:
python -m pdb myscript.py
The console will show you:
> /home/user/dir/myscript.py(2)<module>()
-> first_line (of_my_script) (PDB)
Type continue
Wait for something to explode:
TypeError: invalid type comparison Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > /home/user/problemscript.py(567)na_op() -> raise TypeError("invalid type comparison") (Pdb)
From here you are in MUD and an amazing amount of standard commands apply.
Enter where or w to see where you are on the stack:
(Pdb) w -> return df[df['type']=='dev'][['Dist','Count']].as_matrix() /home/user/core/ops.py(603)wrapper() -> res = na_op(values, other) > /home/user/core/ops.py(567)na_op() -> raise TypeError("invalid type comparison")
Look at the little arrow > ? This is where we are on the stack.
Use the list or l to look around:
(Pdb) list 564 try: 565 result = getattr(x, name)(y) 566 if result is NotImplemented: 567 >> raise TypeError("invalid type comparison") 568 except (AttributeError): 569 -> result = op(x, y) 570 571 return result 572 573 def wrapper(self, other): 574 if isinstance(other, pd.Series):
To move on the stack, continue MUDing and use up ( u ) or down ( d ) ..
Use args ( a ) to check with which arguments the current function is called:
(Pdb) args dat = array([], shape=(0, 3), dtype=float64) dev_classes = {81, 82, 21, 22, 23, 24, 31}
Use p to print the contents of the variable (or pp for beautiful printing (or to cope with your character’s basic needs)):
(Pdb) p df Empty DataFrame Columns: [Dist, type, Count] Index: []
Use interact to enter code at the current point in the stack. Ctrl + D returns you to the PDB.
Walk straight! Many brave and powerful adventurers will need to reverse the collected goblin hordes that now surround the city. Will you defeat the Goblin King to reclaim the land for the races?