pdb

ipdb, multiple threads and autoreloading programs causing ProgrammingError

ぃ、小莉子 提交于 2019-12-10 13:18:51
问题 I am using ipdb debugger to debug multithreaded web applications locally (Django, Plone). Often ipdb seems to get confused because of the autoreload which happens when I am on the debug prompt. The resulting stack trace comes up /Users/mikko/code/xxxx/venv/lib/python2.7/site-packages/IPython/core/history.pyc in writeout_cache(self, conn) 605 with self.db_input_cache_lock: 606 try: --> 607 self._writeout_input_cache(conn) 608 except sqlite3.IntegrityError: 609 self.new_session(conn) /Users

how to disable pdb.set_trace() without stopping python program and edit the code

耗尽温柔 提交于 2019-12-10 04:26:45
问题 I suspect that I have issue in one of my loops, so I setup a break points with pdb.set_trace() import pdb for i in range(100): print("a") pdb.set_trace() print("b") after check variable in this loop for a few times, I decide continue this programming without further breaks. So I try to get the break number with b command, no breaks listed. I guess this line of code don't setup a break point. but How Do I get ride of this "break points" without stopping the program and change the code? 回答1: to

VS生成PDB符号文件和调试Dump配置

你离开我真会死。 提交于 2019-12-09 14:51:06
最近在做QT相关的项目,发现QT插件创建的工程生成的pdb文件没有有效信息,于是与普通工程对比了一下发现了问题所在。所以总结一下pdb文件生成的配置: 配置这两项之后就会生成具有有效格式的pdb了,这里面应该会包含编译时代码的路径,exe和pdb文件的路径。但是实际上在调试dump的时候这些路径不一定还存在。所以需要手动配置,VS很友好,缺少信息时会自动报出。 上面的信息提示没有找到pdb,提示了原始exe的位置,所以这里需要手动设置pdb位置 在这里直接将exe和pdb都放在这个目录下,就不需要设置多次了。点击加载之后: 这里已经打印出了堆栈,但是并没有详细的源代码信息,所以这里需要设置一下对应版本的源代码位置: 右键解决方案->属性->调试源文件->设置路径: 重新启动调试dump: 源代码这样也加载进来了,情况一清二楚。 最近在做QT相关的项目,发现QT插件创建的工程生成的pdb文件没有有效信息,于是与普通工程对比了一下发现了问题所在。所以总结一下pdb文件生成的配置: 来源: CSDN 作者: Freedom3568 链接: https://blog.csdn.net/zhanggqianglovec/article/details/103456713

How do I change a value while debugging python with pdb?

ε祈祈猫儿з 提交于 2019-12-09 08:20:35
问题 I want to run pdb, step through the code, and at some point change the value pointed at by some name. So I might want to change the value pointed at by the name 'stationLat'. But it seems I can't. Here's the example: >>> import extractPercentiles >>> import pdb >>> pdb.run( "extractPercentiles.extractOneStation()" ) > <string>(1)<module>()->None (Pdb) s --Call-- > /scratch/extractPercentiles.py(96)extractOneStation() -> def extractOneStation() : (Pdb) tbreak 132 Breakpoint 3 at /scratch

How to export a variable from PDB?

北慕城南 提交于 2019-12-08 16:43:46
问题 Imagine the following scenario: a script is started from the IPython shell and at a break point the python debugger is called. Using the PDB commands one can analyze the code and variables at this point. But often it turns out that the values of the variables call for a deeper research. Is it possible to export the value of a variable to the IPython shell? My specific use case: I struggle with a quite huge numpy array which does not seem to have the correct values. I know that I can run any

Ipdb and method documentation

一个人想着一个人 提交于 2019-12-08 16:27:18
问题 I have to analyze methods a foreign API, and how I usually do it it to write a test script, or find an example code, do a ipdb.set_trace() Where I want to experiment, and than take a look at currently available variables, objects and their methods. However, when I want to check the documentation the way Ipython offers object.method? I get *** SyntaxError: invalid syntax (<stdin>, line 1) If I try help(object.method) It gives *** No help on (object.method) Does that mean that there is no

Running wxPython 2.9 on OS X 10.8 (64 bit)

时间秒杀一切 提交于 2019-12-08 07:08:44
问题 I have EPD 7.3 and have installed wxPython 2.9 through the Enthought repositories. I tried running winPDB, which requires wxPython and I got this message : This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac. I have seen similar messages from wxPython on Mac, but I haven't found a solution yet. Does anyone know about this message? And, has anyone got WinPDB to work on OS X 10.8 w/ wxPython 2.9?

enter pdb with kill signal

泄露秘密 提交于 2019-12-08 02:47:25
问题 In a recent project, I want to debug my program in production use state. The production environment is very complicated so I want to debug the program whenever I find a problem. This is what I want to achieve: whenever I want to debug, I will send a kill signal to the program and hopefully pdb debugger will appear. It is something like this: import pdb import signal import time def handler(signal, frame): pdb.set_trace() signal.signal(signal.SIGTERM, handler) a=1 while True: a+=1 time.sleep(1

How do I display thread/process Id in Python PDB?

喜夏-厌秋 提交于 2019-12-07 10:20:40
问题 In Python, is there a way to display thread/process ID while debugging using PDB? I was looking at https://docs.python.org/2/library/pdb.html but could not find anything related to it? 回答1: (pdb) import os,threading; os.getpid(), threading.current_thread().ident If you need to do this often, it would be convenient to add an alias in your .pdbrc file: alias tid import os,threading;; p os.getpid(), threading.current_thread().ident 来源: https://stackoverflow.com/questions/39259805/how-do-i

python pdb: resume code execution after exception caught?

*爱你&永不变心* 提交于 2019-12-07 10:04:03
问题 If I run a code with the ipython %pdb magic enabled and the code throws an exception, is there any way to tell the code to continue executing afterwards? e.g., say the exception is a ValueError: x=0 not allowed . Can I, in pdb, set x=1 and allow the code to continue (resume) executing? 回答1: I don't think you can resume code post-mortem (i.e. the exception was actually raised, triggering invocation of the debugger). What you can do, is put breakpoints in your code where you have been seeing