推荐学习书目
› 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
JasonLaw
V2EX  ›  Python

ThreadPoolExecutor 执行任务出错后,如何使它输出异常信息?

  •  
  •   JasonLaw · Dec 1, 2020 · 2292 views
    This topic created in 2130 days ago, the information mentioned may be changed or developed.

    最近使用了 Python 中的concurrent.futures.ThreadPoolExecutor,submit 的任务在执行过程中出现了异常,但是日志却完全没有任何异常信息。

    我找到了下面这些资料:

    使用 Python 中的ThreadPoolExecutor,有没有方法像 Java 中的Executor.execute(Runnable command)一样显式地输出异常信息?或者有什么方法像Thread.setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)一样设置异常处理器?

    1 replies  •  2020-12-03 10:43:51 +08:00
    tisswb
        1
    tisswb  
       Dec 3, 2020
    可以用 logger 记录到日志文件中查看
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2325 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 09:30 · PVG 17:30 · LAX 02:30 · JFK 05:30
    ♥ Do have faith in what you're doing.