Debugging with Python for Excel.

into a file testDbg.pfe. Note the "global" statement. Create and Excel-start
the file named testDbg.xls. Type =pfeEval("f(1,2)") into a cell.

The ControlShell pops up with the error message:

At this point the post-mortem debugging may be started. Press
<Ctrl>+<Enter> to switch to the addin shell and type pdb.pm(). The
debugger starts and installs the current debugging position at the exception
line.

See Python's documentation for more information on the pdb module and
debugging of Python scripts.