问题描述
例如:
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
未选中 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 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 ).
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
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 中调试时如何避免进入内置函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!