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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shinya Okano
June 10, 2023
Technology
950
1
Share
Pythonのデバッガーを使おう
Shinya Okano
June 10, 2023
More Decks by Shinya Okano
See All by Shinya Okano
プロファイラを使ってPythonアプリをチューニングしよう
tokibito
2
1.4k
Djangoテンプレートエンジンを使いこなそう!
tokibito
0
3.1k
Djangoフレームワークの紹介_OSC北海道2019
tokibito
1
1.1k
DjangoCongressJP開催レポート
tokibito
0
100
Djangoフレームワークの紹介 OSC2018do
tokibito
0
2.9k
Other Decks in Technology
See All in Technology
ESP32 IoTを動かしながらメモリ使用量を観測してみた話
zozotech
PRO
0
140
"スキルファースト"で作る、AIの自走環境
subroh0508
0
590
AI 時代の Platform Engineering
recruitengineers
PRO
1
220
React Compiler導入の効果と運用の工夫
kakehashi
PRO
3
260
AsyncStreamでマルチブロードキャストを実装する
1mash0
1
120
「強制アップデート」か「チームの自律」か?エンタープライズが辿り着いたプラットフォームのハイブリッド運用/cloudnative-kaigi-hybrid-platform-operations
mhrtech
0
210
Terragrunt x Snowflake + dbt で作るマルチテナントなデータ基盤構築プラットフォーム
gak_t12
0
420
GCASアップデート(202603-202605)
techniczna
0
210
Swift Sequence の便利 API 再発見
treastrain
1
290
PdM・Eng・QAで進めるAI駆動開発の現在地/aidd-with-pdm-eng-qa
shota_kusaba
0
250
LookerとADKで作る社内AIエージェント
chanyou0311
0
260
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
120
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
330
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
390
Docker and Python
trallard
47
3.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
230
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Balancing Empowerment & Direction
lara
6
1.1k
Facilitating Awesome Meetings
lara
57
6.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
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でデバッグする • こちらのほうが手軽