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
yth492300648
V2EX  ›  Python

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

  •  
  •   yth492300648 · 2019-03-26 21:00:11 +08:00 · 1120 次点击
    这是一个创建于 1830 天前的主题,其中的信息可能已经有所发展或是发生改变。
    RT 做需要长时间挂机的爬虫时间长了可能报错
    但是每次重新点运行还是可以正常运行
    3 条回复    2019-04-02 09:23:14 +08:00
    leavic
        1
    leavic  
       2019-03-27 06:55:29 +08:00 via Android
    你就不能把错误休掉?
    ginyan
        2
    ginyan  
       2019-03-27 09:07:13 +08:00
    用一个 try 和 except 把错误捕捉下来,sleep 几分钟,然后在 except 里面再次调用函数就可以啦。
    1462326016
        3
    1462326016  
       2019-04-02 09:23:14 +08:00
    可能你需要 supervisor 来启动 Python 进程,可以在意外退出的情况下自动重启
    附送 github 链接: https://github.com/Supervisor/supervisor
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2892 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 13:47 · PVG 21:47 · LAX 06:47 · JFK 09:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.