[英]Why is pdb displaying “*** Blank or comment” when I try to set a Break?
I'm working with my Django app. 我正在使用我的Django应用程序。 For some reason an element of a list is being assigned incorrectly.
由于某种原因,列表的元素被错误地分配。
I'm trying to set a break where I think the error is occurring. 我试图在我认为错误发生的地方设置一个休息时间。 ( line 20 )
(第20行)
I'm invoking pdb with this line of code: 我用这行代码调用pdb:
import pdb; pdb.set_trace()
However, inside the code, I can't seem to set a Break. 但是,在代码中,我似乎无法设置Break。
(Pdb) b 20
*** Blank or comment
(Pdb) break 20
*** Blank or comment `
What am I doing wrong? 我究竟做错了什么?
pdb is telling you that line 20 of the file you're in doesn't contain code; pdb告诉你,你所在文件的第20行不包含代码; it's either blank or just contains a comment.
它可以是空白的,也可以只包含注释。 Such a line will never actually be executed, so a breakpoint can't be set on it.
这样的行永远不会被执行,因此无法在其上设置断点。
Use the 'list' command to see the code of the file you're currently in ('help list' for details on this command), and then set breakpoints on lines which include executable code. 使用'list'命令查看当前文件的代码('help list'以获取有关此命令的详细信息),然后在包含可执行代码的行上设置断点。
You can also use the 'where' command to see the stack frame, since you might not be in the right file because you're not looking at the level of the stack frame where you think you are. 您还可以使用'where'命令查看堆栈帧,因为您可能不在正确的文件中,因为您没有查看您认为自己的堆栈帧级别。 Use 'up' and 'down' to go to the level of the stack where you want to debug.
使用'up'和'down'转到要调试的堆栈级别。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.