タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

pdbに関するxefのブックマーク (4)

  • Become a pdb power-user

    This is an explanatory article related to my talk at MUPy — Become a pdb power-user. What’s pdb?pdb is a module from Python’s standard library that allows us to do things like: Stepping through source codeSetting conditional breakpointsInspecting stack traceViewing source codeRunning Python code in a contextPost-mortem debuggingWhy pdb?It is not necessary to use pdb all the time, sometimes we can

    Become a pdb power-user
    xef
    xef 2016/11/15
  • Iterating Faster with PDB and Flask | Kyriblog

    “Although logos is common to all, most people live as if they had a wisdom of their own.” —T.S. Eliot The Flask framework makes it fun and easy to build out ideas and design concepts with just a few lines of code. One trick that has made that even easier is using the Python debugger, PDB, to help write application code. Drop these lines into a Flask view, and visit it with your browser: import pdb

    xef
    xef 2012/12/27
  • Nobo's Blog - PythonコードのデバッグTips(1)

    1   目的 エラー(例外)が発生した時、自動的にデバッガ「pdb」を起動して、 その時点のスタックフレームや上流階層に逆上って状況の確認がしたい! でも止めたい箇所が分散していていちいちブレークポイント貼ったりステップ実行とかしてらんない! みたいな状況で役に立つデバッグ手法です。 2   準備 以下をdebug.pyとして保存しましょう。: 1 import sys 2 3 def hook(type, value, tb): 4 if hasattr(sys, 'ps1') or not sys.stderr.isatty(): 5 sys.__excepthook__(type, value, tb) 6 else: 7 import traceback, pdb 8 traceback.print_exception(type, value, tb) 9 print() 10

    xef
    xef 2012/11/08
  • Python で標準添付の Debuggerのpdb を利用してデバッグするメモ

    概要 pdb を利用してみる。 ドキュメント 公式ドキュメント「pdb — The Python Debugger」に概要が書いてある。 使い方 スクリプトを直接起動してデバッグする方法と、インタラクティブshell で起動する方法があるが、ここでは、スクリプトを起動してデバッグする方法で書く。 以下がデバッグするスクリプトのサンプル「even.py」。 自分の場合、スクリプトを直接デバッグすることがあまりなく、デバッグするのはライブラリとかをunittest経由でデバッグすることがが多いのでサンプルは unittest で書いている。 以下の例はクラス内の関数が偶数だけ返す所でバグがあり、奇数を返すようになっている。そんなに良い例ではないかも。 #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest class Samp

    xef
    xef 2012/11/02
  • 1