Linux下运行python脚本,pudb是一个不错的调试器。

语法高亮,断点,调用栈,命令行,都有了,如下图。

[安装]

pip install pudb

[使用]

pudb xxx.py

[快捷键]

最常用的快捷键,应该是如下几个:

  • n - step over ("next") # 运行到下一行
  • s - step into # 运行进函数
  • c - continue # 继续运行
  • r/f - finish current function # 结束当前函数
  • b - toggle breakpoint # 打断点/取消断点
  • V - focus variables # 聚焦在变量窗口
  • f1/?/H - show this help screen # 显示帮助窗口
  • Ctrl-n/p - browse command line history # 浏览命令行历史
  • t/r/s/c - show type/repr/str/custom for this variable # 切换type/repr/str/custom

界面下按?就能出来快捷键列表,如下:

Welcome to PuDB, the Python Urwid debugger.
------------------------------------------- (This help screen is scrollable. Hit Page Down to see more.) Keys: # 快捷键相关
Ctrl-p - edit preferences # 编辑配置 n - step over ("next") # 运行到下一行
s - step into # 运行进函数
c - continue # 继续运行
r/f - finish current function # 结束当前函数
t - run to cursor # 运行到光标处
e - show traceback [post-mortem or in exception state] # 显示traceback H - move to current line (bottom of stack) # 移动到当前行(栈底)
u - move up one stack frame # 移动到栈的上一行
d - move down one stack frame # 移动到栈的下一行 o - show console/output screen # 显示命令行屏幕(回车返回pudb) b - toggle breakpoint # 打断点/取消断点
m - open module # 打开python模块 j/k - up/down # 上/下
Ctrl-u/d - page up/down # 上一页/下一页
h/l - scroll left/right # 左滚动/右滚动
g/G - start/end # 跳转到首行/末行
L - show (file/line) location / go to line # 跳到指定行
/ - search # 查找
,/. - search next/previous # 查找下一个/上一个 V - focus variables # 聚焦在变量窗口
S - focus stack # 聚焦在栈窗口
B - focus breakpoint list # 聚焦在断点列表窗口
C - focus code # 聚焦在代码窗口 f1/?/H - show this help screen # 显示帮助窗口
q - quit # 退出 Ctrl-c - when in continue mode, break back to PuDB # 当处于连续模式时,返回pudb Ctrl-l - redraw screen # 重绘窗口 Command line-related: # 命令行相关
! - invoke configured python command line in current environment # 进入命令行窗口
Ctrl-x - toggle inline command line focus # 切换命令行窗口和代码窗口 +/- - grow/shrink inline command line (active in command line history) # 增长/缩减命令行(命令行历史下激活)
_/= - minimize/maximize inline command line (active in command line history)# 最小化/最大化命令行(命令行历史下激活) Ctrl-v - insert newline # 插入新行
Ctrl-n/p - browse command line history # 浏览命令行历史
Tab - yes, there is (simple) tab completion # 快速补齐 Sidebar-related (active in sidebar): # 工具栏相关(工具栏激活时有效)
+/- - grow/shrink sidebar # 扩大/缩减工具栏(指的是工具栏宽度)
_/= - minimize/maximize sidebar # 最小化/最大化工具栏
[/] - grow/shrink relative size of active sidebar box # 扩大/缩减激活工具栏相对大小(指的是窗口高度) Keys in variables list: # 变量列表窗口的快捷键
\ - expand/collapse # 展开/收缩
t/r/s/c - show type/repr/str/custom for this variable # 切换type/repr/str/custom
h - toggle highlighting # 切换高亮
@ - toggle repetition at top # 切换顶部重复
* - cycle attribute visibility: public/_private/__dunder__ # 属性的循环可视化
m - toggle method visibility # 切换方法的可见性
w - toggle line wrapping # 切换换行
n/insert - add new watch expression # 添加新的watch表达式
enter - edit options (also to delete) # 编辑选项 Keys in stack list: # 栈列表窗口的快捷键 enter - jump to frame # 跳到某帧 Keys in breakpoints view: # 断点列表窗口的快捷键 enter - edit breakpoint # 编辑断点
d - delete breakpoint # 删除断点
e - enable/disable breakpoint # 启用/禁用断点

当你不知道如何点中OK键时,试试移动上下左右的箭头键,Enjoy it :)

最新文章

  1. mongodb基础篇
  2. 前端 js 实现简单 表单提交
  3. 小结一下前段时间做的rpgdemo
  4. asp.net Web.config 在不同版本的IIS配置的IHttpHandler的访问路径,以及经典模式和集成模式不同的配置
  5. 重新想象 Windows 8.1 Store Apps (73) - 新增控件: DatePicker, TimePicker
  6. Excel 生成sql语句
  7. [saiku] 通过 saiku 的 DEMO 分析 connection
  8. String.Format格式说明(转)
  9. SequoiaDB 与 Hive 集成
  10. Android中利用Handler实现消息的分发机制(三)
  11. Android开发遇到手机无法弹出Toast
  12. ESP8266莫名重启或者死机问题
  13. mysql的"双1设置"-数据安全的关键参数(案例分享)
  14. 错误模块名称: KERNELBASE.dll错误
  15. ie8 background背景图片不显示问题
  16. ZOJ1363 Chocolate
  17. 免费获取 Kaspersky Small Office Security 90 天授权
  18. 在服务器中使用 Entity Framework 的 Migration 更新数据库
  19. JDK源码分析:Object.java
  20. Luogu 1099 树网的核

热门文章

  1. linux系统中-E,-S,-c的区别和作用(怎么讲代码转化为机器识别的语言)
  2. easyui menu 添加hideItem/showItem 方法
  3. table与html实例
  4. JAVA8之lambda表达式详解,及stream中的lambda使用
  5. Using Fast Weights to Attend to the Recent Past
  6. C#调用ActiveX
  7. crontab读不来环境变量
  8. js阻止表单提交
  9. poj 2531(dfs)
  10. 用12个例子全面示范Angular的模板语法