【问题标题】:debugging python code while doing unitest using ipdb ResourceWarning在使用 ipdb ResourceWarning 进行 unitest 时调试 python 代码
【发布时间】:2020-03-05 14:12:38
【问题描述】:

我有一个在 Ubuntu 16 上运行良好的 python 代码。我安装了 Ubuntu 18,现在当我尝试在执行 unitest 时调试代码时,每次按“n”或“s”时都会收到以下警告:

ipdb> /usr/lib/python3.7/asyncio/base_events.py:618: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
  source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

我使用 python 3.7.5

如何消除此警告?不可能这样工作

【问题讨论】:

  • 我在 osx 上遇到了这个问题。将我的 python 升级到 3.8.1,我仍然遇到这个问题。

标签: python-3.x debugging ubuntu-18.04 ipdb


【解决方案1】:

使用python -W ignore script.py 运行可以在调试时摆脱这种情况。

【讨论】:

  • 不是真正的解决方案,而是有用的解决方法。其他警告可能很重要。
猜你喜欢
  • 2016-06-07
  • 1970-01-01
  • 2019-05-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-10
  • 2015-01-11
  • 1970-01-01
相关资源
最近更新 更多