V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2017-11-20 10:00:02 +08:00 · 2696 次点击
    这是一个创建于 2341 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

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

    4 条回复    2017-11-20 14:20:03 +08:00
    dbow
        1
    dbow  
       2017-11-20 10:12:40 +08:00   ❤️ 1
    把进程的 stdin, stout , stderr 换成 pipe, 这样 pdb.set_trace 就能正常使用, 控制命令从 pipe 里输进去。
    NoAnyLove
        2
    NoAnyLove  
       2017-11-20 10:27:34 +08:00   ❤️ 1
    eric6356
        3
    eric6356  
       2017-11-20 10:32:40 +08:00   ❤️ 1
    cherrot
        4
    cherrot  
       2017-11-20 14:20:03 +08:00
    @eric6356 简单高效!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   982 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:07 · PVG 04:07 · LAX 13:07 · JFK 16:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.