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
1
910
Pythonのデバッガーを使おう
Shinya Okano
June 10, 2023
Tweet
Share
More Decks by Shinya Okano
See All by Shinya Okano
プロファイラを使ってPythonアプリをチューニングしよう
tokibito
2
1.3k
Djangoテンプレートエンジンを使いこなそう!
tokibito
0
2.8k
Djangoフレームワークの紹介_OSC北海道2019
tokibito
1
1.1k
DjangoCongressJP開催レポート
tokibito
0
88
Djangoフレームワークの紹介 OSC2018do
tokibito
0
2.8k
Other Decks in Technology
See All in Technology
リモートワークで心掛けていること 〜AI活用編〜
naoki85
0
200
第4回 関東Kaggler会 [Training LLMs with Limited VRAM]
tascj
8
1.3k
AI時代の大規模データ活用とセキュリティ戦略
ken5scal
1
270
Engineering Failure-Resilient Systems
infraplumber0
0
130
Amazon S3 Vectorsは大規模ベクトル検索を低コスト化するサーバーレスなベクトルデータベースだ #jawsugsaga / S3 Vectors As A Serverless Vector Database
quiver
2
1.1k
Amazon Bedrock AgentCore でプロモーション用動画生成エージェントを開発する
nasuvitz
6
340
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
2
20k
人を動かすことについて考える
ichimichi
2
230
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.5k
サイボウズフロントエンドの横断活動から考える AI時代にできること
mugi_uno
3
1.3k
Mackerel in さくらのクラウド
cubicdaiya
1
390
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
240
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Optimizing for Happiness
mojombo
379
70k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
How STYLIGHT went responsive
nonsquared
100
5.7k
Typedesign – Prime Four
hannesfritz
42
2.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Building Applications with DynamoDB
mza
96
6.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
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でデバッグする • こちらのほうが手軽