pdb

Run pdb without stdin/stdout using FIFO

独自空忆成欢 提交于 2019-11-29 22:02:41
问题 I am developing FUSE filesystem with python. The problem is that after mounting a filesystem I have no access to stdin/stdout/stderr from my fuse script. I don't see anything, even tracebacks. I am trying to launch pdb like this: import pdb pdb.Pdb(None, open('pdb.in', 'r'), open('pdb.out', 'w')).set_trace() All works fine but very inconvenient. I want to make pdb.in and pdb.out as fifo files but don't know how to connect it correctly. Ideally I want to type commands and see output in one

Installing Theano on Windows - DLL load failed

人盡茶涼 提交于 2019-11-29 20:55:06
问题 I am trying to install Theano on Windwos 8 Have followed these steps. I try to test using: import numpy as np import time import theano print('blas.ldflags=', theano.config.blas.ldflags) A = np.random.rand(1000, 10000).astype(theano.config.floatX) B = np.random.rand(10000, 1000).astype(theano.config.floatX) np_start = time.time() AB = A.dot(B) np_end = time.time() X, Y = theano.tensor.matrices('XY') mf = theano.function([X, Y], X.dot(Y)) t_start = time.time() tAB = mf(A, B) t_end = time.time(

Debuggers not acting properly on Jupyter notebooks

坚强是说给别人听的谎言 提交于 2019-11-29 19:53:47
问题 I'm trying to debug some code in a Jupyter notebook. I've tried 3 4 different methods, and they all suffer from the same problem: --Return-- None > <ipython-input-22-04c6f5c205d1>(3)<module>() 1 import IPython.core.debugger as dbg 2 dber = dbg.Tracer() ----> 3 dber() 4 tst = huh.plot(ret_params=True) 5 type(tst) ipdb> n > y:\miniconda\lib\site-packages\ipython\core\interactiveshell.py(2884)run_code() 2882 finally: 2883 # Reset our crash handler in place -> 2884 sys.excepthook = old_excepthook

How to exit pdb and allow program to continue?

时光总嘲笑我的痴心妄想 提交于 2019-11-29 19:30:18
I'm using the pdb module to debug a program. I'd like to understand how I can exit pdb and allow the program to continue onward to completion. The program is computationally expensive to run, so I don't want to exit without the script attempting to complete. continue doesn't seems to work. How can I exit pdb and continue with my program? continue should "Continue execution, only stop when a breakpoint is encountered", so you've got a breakpoint set somewhere. To remove the breakpoint (if you inserted it manually): (Pdb) break Num Type Disp Enb Where 1 breakpoint keep yes at /path/to/test.py:5

pdb cannot break in another thread?

岁酱吖の 提交于 2019-11-29 17:04:10
问题 Consider this multi-threaded program: import threading class SomeThread(threading.Thread): def run(self): a = 1 print a def main(): print 'hola' someThread = SomeThread() someThread.start() if __name__ == '__main__': main() When I debug this program with pdb, at the prompt I first set a break point at each of the two print statements. Then I continue. pdb breaks at print 'hola' . I continue again and see the effect of the print in the other thread, but pdb doesn't break. The help commands don

量化编程技术—pdb进行调试

感情迁移 提交于 2019-11-29 16:04:46
# -*- coding: utf-8 -*- # @Date: 2017-08-26 # @Original: import pdb def gen_buy_change_list(): buy_change_list = [] for buy_change in xrange(-5, -16, -1): # 只针对循环执行到buy_change == -10,中断开始调试 if buy_change == -10: # 打断点,通过set_trace pdb.set_trace() buy_change = buy_change / 100 buy_change_list.append(buy_change) # 故意向外抛出异常 raise RuntimeError('debug for pdb') return buy_change_list try: _ = gen_buy_change_list() except Exception as e: # 从捕获异常的地方开始调试,经常使用的调试技巧 pdb.set_trace() 来源: https://www.cnblogs.com/fangbei/p/11521536.html

all variables are undefined in python debugger

北战南征 提交于 2019-11-29 12:57:06
I'm facing a very strange issue on Python 3.6. In the middle of my code, I call import pdb; pdb.set_trace() to debug some code. And then I'm not able to debug properly, for instance: (Pdb) abc = 3 (Pdb) [abc for _ in range(2)] *** NameError: name 'abc' is not defined (Pdb) [abc, abc] [3, 3] It seems like whenever I use list comprehensions, there is an issue of variable not defined. However, if I call the debugger right after I open Python, I do not observe this behavior, everything runs fine. Any ideas why I'm having this issue? This happens because list comprehensions are (mostly) evaluated

Get IPython tab completion for ipdb

痴心易碎 提交于 2019-11-29 11:42:38
问题 I have IPython(0.13.1) and ipdb(0.7) installed, I inserted the line import ipdb;ipdb.set_trace() in my script and ran python my_script.py . Now I am in the ipdb prompt and there is some autocompletion (e.g. a bare tab) but it's not the same as the autocompletion I get when I enter IPython. In the ipdb prompt requests. then <tab> (after import) does not give me a list of attributes as in IPython. How do I get that same tab completion as in IPython with ipdb? Btw, when I run python -m ipdb my

python: in pdb is it possible to enable a breakpoint only after n hit counts?

浪子不回头ぞ 提交于 2019-11-29 11:06:29
问题 In eclipse (and several other IDE's as well) there is an option to turn on the breakpoint only after a certain number of hits. In Python's pdb there is a hit count for breakpoints and there is the condition command. How do I connect them? 回答1: Conditional Breakpoints can be set in 2 ways - FIRST: specify the condition when the breakpoint is set using break python -m pdb pdb_break.py > .../pdb_break.py(7)<module>() -> def calc(i, n): (Pdb) break 9, j>0 Breakpoint 1 at .../pdb_break.py:9 (Pdb)

How to debug python CLI that takes stdin?

非 Y 不嫁゛ 提交于 2019-11-29 06:49:34
问题 I'm trying to debug a Python CLI I wrote that can take its arguments from stdin. A simple test case would have the output of echo "test" | python mytool.py be equivalent to the output of python mytool.py test I'd like to debug some issues with this tool, so I tried to run this: echo "test" | pdb mytool.py But I get this output, then pdb exits: > /path/to/mytool.py(5)<module>() -> ''' (Pdb) *** NameError: name 'test' is not defined (Pdb) The same thing occurs when I add -m python to the