V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
yth492300648
V2EX  ›  Python

pychram 能不能自动重启报错的 py 文件

  •  
  •   yth492300648 · Mar 26, 2019 · 1562 views
    This topic created in 2588 days ago, the information mentioned may be changed or developed.
    RT 做需要长时间挂机的爬虫时间长了可能报错
    但是每次重新点运行还是可以正常运行
    3 replies    2019-04-02 09:23:14 +08:00
    leavic
        1
    leavic  
       Mar 27, 2019 via Android
    你就不能把错误休掉?
    ginyan
        2
    ginyan  
       Mar 27, 2019
    用一个 try 和 except 把错误捕捉下来,sleep 几分钟,然后在 except 里面再次调用函数就可以啦。
    1462326016
        3
    1462326016  
       Apr 2, 2019
    可能你需要 supervisor 来启动 Python 进程,可以在意外退出的情况下自动重启
    附送 github 链接: https://github.com/Supervisor/supervisor
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5627 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 08:35 · PVG 16:35 · LAX 01:35 · JFK 04:35
    ♥ Do have faith in what you're doing.