简体   繁体   English

如何在spyder中设置条件断点?

[英]How to set up conditional breakpoints in spyder?

it was supposed to be incredibly simple to find answer in open internet but apparently not. 在开放的互联网上找到答案本来应该非常简单,但显然并非如此。 How do you set conditional breakpoints in spyder (anaconda)? 如何在spyder(anaconda)中设置条件断点?

for example here is a fraction of the code: 例如,以下是部分代码:

   if elem.name == "p":
      for b_elem in elem.select('b'):
         if not re_date.match(b_elem.text):
            speaker = b_elem.text.strip(':')

I want to set up a conditional breakpoint when speaker equals to 'Foreign National Offenders (Exclusion from the UK) Bill' 我想在说话者等于“外国国民罪犯(英国除外)条例草案”时设立一个有条件的断点

i tried to set the red dot next to the speaker, right click and edit conditional breakpoint like this: speaker == 'Foreign National Offenders (Exclusion from the UK) Bill' 我试图在演讲者旁边设置红点,右键单击并编辑条件断点,如下所示:演讲者==“外国国家罪犯(英国除外)条例草案”

but the code does not stop at this breakpoint. 但是代码不会在此断点处停止。 I wonder why. 我想知道为什么。 Does anyone know how to set it up properly? 有人知道如何正确设置吗?

thank you 谢谢

The debugger stops at the row where you put the breakpoint before evaluating the row. 评估行之前 ,调试器将在您放置断点的行处停止。 So, to have the debug stop based on the value of variable "speaker", you should insert the conditional breakpoint on a row below the one where "speaker" is defined. 因此,要使调试停止基于变量“ speaker”的值,应将条件断点插入定义“ speaker”的断点下方的一行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM