사용자 도구

사이트 도구


python:debug

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
python:debug [2020/06/13 09:51] – 만듦 rex8312python:debug [2025/02/20 02:15] (현재) rex8312
줄 1: 줄 1:
 ====== Python: Debug ====== ====== Python: Debug ======
  
-  * CPU/Memory 사용량 측정/제한 +| Examine exception from interpreter |jupyter notebook 'debug'         | 
-    * https://towardsdatascience.com/python-tips-and-trick-you-havent-already-seen-37825547544f +| Pinpoint variables in scope        |import IPython; IPython.embed() 
-    * https://python.flowdas.com/library/resource.html+| Pinpoint variables in scope        |import code; code.interact(local=locals())  |  
 +| :::                                |whos                             | 
 +| Set breakpoint                     |import pudb; pudb.set_trace()    | 
 +| Run with debugger                  |pudb -- xyz.py arg1 arg2         | 
 +| Start debugger on CTRL-C           |import                           | 
 +| :::                                |pudbpudb.set_interrupt_handler() | 
 +| Trace threads                      |import wdb; wdb.set_trace()      | 
 +| Record logs                        |logging.getLogger(__name__)      | 
 +| Debug tests                        |pip install pdbpp; py.test --pdb | 
 + 
 +  Debugging Tips, Roy Hyunjin Han, PyCon Asia Pacific 2016 
 + 
 + 
 +<code python> 
 +import sys 
 +from ptpdb import set_trace 
 +sys.breakpointhook = set_trace 
 +</code> 
 + 
 +<code python> 
 +# https://www.python.org/dev/peps/pep-0553/ 
 +os.environ['PYTHONBREAKPOINT'] = 'foo.bar.baz' 
 +breakpoint()    # Imports foo.bar and calls foo.bar.baz() 
 + 
 +set PYTHONBREAKPOINT="from IPython import embed; embed()" 
 +</code> 
 + 
 +  * https://blog.ionelmc.ro/2013/06/05/python-debugging-tools/ 
 +  * https://documen.tician.de/pudb/ 
 +  * https://github.com/inducer/pudb 
 +  * https://github.com/Kozea/wdb  # web debugger 
 + 
 +===== 원격 embed ===== 
 + 
 +  * https://github.com/pandolia/remote_embed 
 +  * https://github.com/romanvm/python-web-pdb 
 + 
 +===== print 문 대안 ===== 
 + 
 +  * https://github.com/gruns/icecream 
 +  * https://github.com/robdmc/behold 
 + 
 + 
 +===== CPU/Memory 사용량 측정/제한 ===== 
 + 
 +  * https://towardsdatascience.com/python-tips-and-trick-you-havent-already-seen-37825547544f 
 +  * https://python.flowdas.com/library/resource.html 
 + 
python/debug.1592041903.txt.gz · 마지막으로 수정됨: (바깥 편집)