Source

pyptug / debug / presentation / index.html

Full commit
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>The Lost Art Of Digital Entomology</title><meta name="generator" content="Hovercraft! 1.0 http://regebro.github.com/hovercraft"></meta><link rel="stylesheet" href="css/hovercraft.css" media="all"></link><link rel="stylesheet" href="css/impressConsole.css" media="all"></link><link rel="stylesheet" href="css/highlight.css" media="all"></link><link rel="stylesheet" href="imp.css" media="all"></link></head><body class="impress-not-supported"><div id="impress"><div class="step" step="0" data-x="0" data-y="0"><p class="center"><strong>PYPTUG</strong></p><p class="center"><strong>The Lost Art Of Digital Entomology</strong></p><p class="center">Francois Dion - <a href="mailto:francois.dion@gmail.com">francois.dion@gmail.com</a> - @f_dion</p></div><div class="step" step="1" data-x="1600" data-y="0"><h1 xmlns="" id="prevention">prevention</h1><p>documentation</p><p>try: except: raise: (exceptions)</p><p>pep8, pylint, pycoverage</p><p>unit testing</p><p>source control (reporting, auto build, blame)</p></div><div class="step" step="2" data-x="3200" data-y="0"><p>print</p></div><div class="step" step="3" data-x="4800" data-y="0"><h1 xmlns="" id="logging">logging</h1><p>import logging</p><p>logging.debug...</p><p>logging.exception...</p></div><div class="step" step="4" data-x="6400" data-y="0"><h1 xmlns="" id="tracing">tracing</h1><p>python -mtrace --trace script.py</p></div><div class="step" step="5" data-x="8000" data-y="0"><h1 xmlns="" id="pdb">pdb</h1><p>import pdb; pdb.set_trace();</p><p>from pdb import set_trace as brk</p><p>python -mpdb script.py</p><p>full interpreter shell:</p><p>import code; code.interact(local=locals());</p></div><div class="step" step="6" data-x="9600" data-y="0"><h1 xmlns="" id="ipdb">ipdb</h1><p>ipython enabled pdb. pdb exports functions to access the IPython debugger, which features tab completion, syntax highlighting, better tracebacks, better introspection with the same interface as the pdb module.</p><p>bin/ipdb mymodule.py</p><p>python -m ipdb mymodule.py</p></div><div class="step" step="7" data-x="11200" data-y="0"><h1 xmlns="" id="debug">debug</h1><p>pip install debug</p><p>import debug</p><p>really ipdb + see()</p></div><div class="step" step="8" data-x="12800" data-y="0"><h1 xmlns="" id="pydb">pydb</h1><p>pydb --- enhanced Python debugger</p><p>SYNOPSIS
pydb [debugger-options] python-script [script-options...]
DESCRIPTION
This manual page documents briefly the pydb command.</p><p>pydb is an extended Python debugger. It extends the Python standard debugger pdb and is suited for use with the graphical debugger DDD. The purpose of a debugger such as this one is to allow you to see what is going on ``inside'' another program while it executes---or what another program was doing at the moment it crashed.</p><p>Inline literal start-string without end-string.</p><p>We follow gdb's command set unless there's good reason not to.</p></div><div class="step" step="9" data-x="14400" data-y="0"><p>can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:</p><blockquote><ul><li>Start or restart your Python script, specifying arguments that might affect its behavior.</li><li>Make your program stop at various points possibly determined by</li></ul><p>Bullet list ends without a blank line; unexpected unindent.</p><blockquote><p>specified conditions.</p></blockquote><ul><li>Examine what has happened when your program has stopped.</li><li>Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another.</li></ul></blockquote></div><div class="step" step="10" data-x="16000" data-y="0"><h1 xmlns="" id="idle">idle</h1><p>demo</p></div><div class="step" step="11" data-x="17600" data-y="0"><h1 xmlns="" id="winpdb">winpdb</h1><p><a href="http://code.google.com/p/winpdb/wiki/DebuggingTutorial">http://code.google.com/p/winpdb/wiki/DebuggingTutorial</a></p><p>better to do this:
see remote.py
launch winpdb, attach -&gt; enter password</p></div><div class="step" step="12" data-x="19200" data-y="0"><h1 xmlns="" id="firefox-plugins">Firefox plugins</h1><p>firebug
LORI
firelogger : <a href="http://firelogger.binaryage.com/">http://firelogger.binaryage.com/</a>
pip install firepython</p></div><div class="step" step="13" data-x="20800" data-y="0"><h1 xmlns="" id="debugging-from-ide">debugging from IDE</h1><p>Python Tools for Visual Studio</p><p>Eclipse (and aptana studio):
<a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse</a></p><p>ninja-ide</p><p>python(x,y)</p></div><div class="step" step="14" data-x="22400" data-y="0"><h1 xmlns="" id="os-level-tools">OS level tools</h1><p>dtrace, ldtrace, strace</p><p>top, htop, prstat (-mL !)</p><p>gdb -&gt; you are in trouble if you've gone through all your other options...</p></div></div><div id="hovercraft-help"><table><tr><th>Space</th><td>Forward</td></tr><tr><th>Left, Down, Page Down</th><td>Next slide</td></tr><tr><th>Right, Up, Page Up</th><td>Previous slide</td></tr><tr><th>P</th><td>Open presenter console</td></tr><tr><th>H</th><td>Toggle this help</td></tr></table></div><script type="text/javascript" src="js/impress.js"></script><script type="text/javascript" src="js/impressConsole.js"></script><script type="text/javascript" src="js/hovercraft.js"></script></body></html>