Add print statements at chosen points, while watching standard output by running the activity from within Terminal;
Add calls to logger.error at chosen points, while watching output as above, or the Sugar logs.
In Terminal, change to the activity directory, and then run the activity under control of the debugger;
python -m pdb /usr/bin/sugar-activity .
At the (pdb) prompt, step from sugar-activity into the activity proper.
Install epdb on Fedora
dnf install python-epdb
Install epdb on Debian or Ubuntu
apt install python-pip pip install epdb
Add epdb to your activity at the point you wish to begin debugging
def __init__(self): import epdb epdb.set_trace()
Run your activity and interact with the debugger
At the (Epdb) prompt, step through your program.