pdb

Can I step into Python library code?

前提是你 提交于 2020-08-24 07:33:05
问题 When I run my Python debugger, I can step into functions that I write. But if I try to step into a library function like os.mkdir("folder") , for example, it "steps over" it instead. Is there a way to step into builtin library functions to see what Python is doing under the hood? Ideally there'd be a way to do this in PyPy so that you could keep drilling down into Python code. 回答1: pdb , the Python Debugger, cannot step into C functions like os.mkdir , but gdb can. Try this: gdb --args python

Python-pdb skip code (as in “not execute”)

南楼画角 提交于 2020-08-22 07:31:13
问题 Is there a way to skip a line or two altogether in pdb? Say I have a pdb session: > print 10 import pdb; pdb.set_trace() destroy_the_universe() # side effect useful_line() And I want to go straight to useful_line() WITHOUT invoking pdb() once again, or destroying the universe. Is there a way to skip (i.e. not execute code) what is between print 10 and useful_line()? 回答1: Use the j / jump command: test.py contains: def destroy_the_universe(): raise RuntimeError("Armageddon") def useful_line():

Step into subroutine call, but not calls made for parameters

别说谁变了你拦得住时间么 提交于 2020-06-17 09:20:53
问题 func(a(), b.c) When executing the line above in the pdb debugger, using step will actually step into a , and then into the getter for b.c if its atypical (such as being a property ), before actually stepping into func . Generally I find myself using step followed by r to return from the frames I'm not interested in, and often inexplicably pass over and miss the opportunity to step directly into func . How do I step directly into func , or what sequence of debugger commands will guarantee that

Why I'm getting this error when I import pdb? 'module' object has no attribute 'ascii_letters'

允我心安 提交于 2020-06-13 12:21:05
问题 Trying to debug my code, I'm importing the library pdb import sys from subprocess import check_call import pdb /*functions*/ if __name__== "__main__": /* Code */ I'm receiving this error: File "reg.py", line 11, in <module> import pdb File "/usr/lib/python2.7/pdb.py", line 9, in <module> import cmd File "/usr/lib/python2.7/cmd.py", line 53, in <module> IDENTCHARS = string.ascii_letters + string.digits + '_' AttributeError: 'module' object has no attribute 'ascii_letters' If I create a new

Why I'm getting this error when I import pdb? 'module' object has no attribute 'ascii_letters'

做~自己de王妃 提交于 2020-06-13 12:19:20
问题 Trying to debug my code, I'm importing the library pdb import sys from subprocess import check_call import pdb /*functions*/ if __name__== "__main__": /* Code */ I'm receiving this error: File "reg.py", line 11, in <module> import pdb File "/usr/lib/python2.7/pdb.py", line 9, in <module> import cmd File "/usr/lib/python2.7/cmd.py", line 53, in <module> IDENTCHARS = string.ascii_letters + string.digits + '_' AttributeError: 'module' object has no attribute 'ascii_letters' If I create a new

pdb bypass error/Jump failed: can only jump from a 'line' trace event

那年仲夏 提交于 2020-05-27 04:32:46
问题 I'm trying to debug a Python program using pdb. The program could be like this: def main(): a = 1 print(b) c = 2 d = 3 Apparently, print(b) is a typo which should be print(a) but it is not important and I can fix it with the text editor but I want to bypass this error and continue debugging. I tried jump, like jump 4(assuming "c=2" is line 4) but I was given error "Jump failed: f_lineno can only be set by a line trace function", which means I need to give a line trace function when I'm

Can you jump to the nth iteration in a loop?

和自甴很熟 提交于 2020-05-08 18:00:27
问题 42 -> for i in range(n): 43 foo(i) Here I am, in the middle of a pdb session. I want to jump to the loop iteration with i = k , without evaluating foo(i) for i < k , AND then continue evaluating foo(i) for i > k . If I step forward a line to 42 for i in range(n): 43 -> foo(i) set i = k , and continue , then i goes back to 1 at the next iteration. Can I make it go to k + 1 instead? 回答1: You cannot 'skip forward' and back, no. You can only execute the loop as written; to get to iteration k you

Can you jump to the nth iteration in a loop?

霸气de小男生 提交于 2020-05-08 18:00:15
问题 42 -> for i in range(n): 43 foo(i) Here I am, in the middle of a pdb session. I want to jump to the loop iteration with i = k , without evaluating foo(i) for i < k , AND then continue evaluating foo(i) for i > k . If I step forward a line to 42 for i in range(n): 43 -> foo(i) set i = k , and continue , then i goes back to 1 at the next iteration. Can I make it go to k + 1 instead? 回答1: You cannot 'skip forward' and back, no. You can only execute the loop as written; to get to iteration k you

Oracle12c 手动创建pdb

為{幸葍}努か 提交于 2020-04-02 11:15:47
Oracle12c中采用容器数据库方式和插拔式数据库 进行存储数据时,随着业务量增加,采用分库的方式来存储,分布到不同存储设备上,可提高整体性能. 以下为 采用sql脚本创建pdb: 创建pdb数据库对应的存储路径 保证创建的目录为空目录 mkdir /u01/oradata/orcl/test 创建表空间 对应数据库文件 存储路径可查看对应 参数 db_create_file_dest create tablespace ts_test datafile 'mkdir /u01/oradata/orcl/test/test01.dbf' size 100M autoextend on next 50M; 依据种子seed创建 pdb create pluggable database test admin user test identified by 123456 roles=(dba) default tablespace ts_test datafile 'mkdir /u01/oradata/orcl/test/test01.dbf' size 100M autoextend on file_name_convert(' /u01/oradata/orcl/pdbseed',' /u01/oradata/orcl/test') path_prefix=' /u01