Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Pythonのデバッガーを使おう
Search
Shinya Okano
June 10, 2023
Technology
960
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pythonのデバッガーを使おう
Shinya Okano
June 10, 2023
More Decks by Shinya Okano
See All by Shinya Okano
プロファイラを使ってPythonアプリをチューニングしよう
tokibito
2
1.5k
Djangoテンプレートエンジンを使いこなそう!
tokibito
0
3.1k
Djangoフレームワークの紹介_OSC北海道2019
tokibito
1
1.1k
DjangoCongressJP開催レポート
tokibito
0
110
Djangoフレームワークの紹介 OSC2018do
tokibito
0
2.9k
Other Decks in Technology
See All in Technology
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
190
Sets in Go
ramalho
1
1.2k
Go 1.27 の標準パッケージに uuid が入った!のでいろいろ喋る / go_127_std_go_uuid
convto
3
560
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.5k
AI・HPC開発を支えるGPU環境の新しい選択肢 液冷GPUシステム「AquSys」の取り組み
gpuunite_official
0
170
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
Head First モブプログラミング / Head First Mobprogramming
takaking22
10
12k
英語が話せなくてもKubeConスタッフに参加した話
yusuke427
0
1k
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
4
26k
NANDでも描画したい!
nichica906
0
290
その“隠したつもり”が命取り ── 自前と平文をやめて「正解」に委ねる
kuroneko13
0
140
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
5
750
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
260
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
420
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
Facilitating Awesome Meetings
lara
57
7.1k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
For a Future-Friendly Web
brad_frost
183
10k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
420
Transcript
Pythonのデバッガーを 使おう @tokibito
Pythonのプログラムをデバッグする • デバッグ方法は色々 • print関数を入れる? • ロギングlogging.debug関数を使う? • 組み込みのデバッガーpdbモジュール
pdbモジュール • https://docs.python.org/ja/3/library/pdb.html • 標準で入っている • CUIで使える • Pythonがあれば通常どこでも使えるので覚えておくとよい
ブレークポイントをコード内に指定 • 組み込みのbreakpoint()関数 • import pdb; pdb.set_trace()
pdbから起動する • python -m pdb my-script.py
pdbのコマンド • b: ブレークポイント指定 • ファイル名:行番号 • c: ブレークポイントまで継続 •
s: ステップ実行 • l: 現在の実行位置を表示 • n: 次の呼び出しまで進む • q: 終了
pdb以外のデバッガ • ipdb • IPythonのインターフェースなので使いやすい • pudb • CUIだがリッチなデバッガー
他のデバッグ方法 • VSCodeでデバッグする • こちらのほうが手軽