How to avoid step into built-in functions when debugging in PyCharm?(在 PyCharm 中调试时如何避免进入内置函数?)
问题描述
例如:
df = load_dataset(os.path.join(os.path.dirname(dataset), "aclImdb"))
我不想调试 dirname
和 join
,因为它们是 Python 内置函数,但只想调试用户定义的函数,如 load_dataset
.
有没有办法在 PyCharm 中控制它?
当你按下
以下是仅使用标准库的代码示例,可复制用于测试
导入操作系统定义我的函数():返回 2my_str = str(os.path.join(os.getcwd(), str(my_function())))
此屏幕截图显示使用 Step into
F7 未选中 Do not step into library scripts
和 Always do smart step into代码>已检查.
注意 3 个设置选项是相互关联的,如果您选择 Do not step into library scripts
和 Always do smart step into
IDE 仍然会给您一个选择进入库函数.如果您取消选中后一个选项,上述示例将自动进入您的函数.
For example:
df = load_dataset(os.path.join(os.path.dirname(dataset), "aclImdb"))
I don't want to debug dirname
and join
, since they are Python built-in functions, but only want to debug user defined functions like load_dataset
.
Is there a way to control that in PyCharm?
It's possible to stop the debugger from stepping into library functions when you press Step into F7 bu going to File
>
Settings
>
Build, Execution, Deployment
>
Debugger
>
Stepping
>
Python
and checking the option Do not step into library scripts
.
(One alternative could also be using Step into my code Alt + Shift + F7).
As shown in the screenshot.
The following is a code example using only standard library that can be copied for testing
import os
def my_function():
return 2
my_str = str(os.path.join(os.getcwd(), str(my_function())))
This screenshot shows using Step into
F7 having Do not step into library scripts
unchecked and Always do smart step into
checked.
Notice the 3 setting options are interconnected, if you choose Do not step into library scripts
together with Always do smart step into
the IDE will still give you a choice to step into the library function. If you uncheck the later option the above example will automatically step into your function.
这篇关于在 PyCharm 中调试时如何避免进入内置函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PyCharm 中调试时如何避免进入内置函数?
基础教程推荐
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 筛选NumPy数组 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01