推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
whx20202
V2EX  ›  Python

Python fork 的进程怎么 pdb 呢?

  •  
  •   whx20202 · Nov 20, 2017 · 3490 views
    This topic created in 3094 days ago, the information mentioned may be changed or developed.

    我在程序一开始的时候 fork 一个进程,仅仅作为后台用,然后主进程就退出了

    在业务代码里面 import pdb pdb.set_trace() 就报错

    除了打日志还有什么好办法吗

    4 replies    2017-11-20 14:20:03 +08:00
    dbow
        1
    dbow  
       Nov 20, 2017   ❤️ 1
    把进程的 stdin, stout , stderr 换成 pipe, 这样 pdb.set_trace 就能正常使用, 控制命令从 pipe 里输进去。
    eric6356
        3
    eric6356  
       Nov 20, 2017   ❤️ 1
    cherrot
        4
    cherrot  
       Nov 20, 2017
    @eric6356 简单高效!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3311 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 00:31 · PVG 08:31 · LAX 17:31 · JFK 20:31
    ♥ Do have faith in what you're doing.