如何抑制pymodbus asyncio的折旧警告
我们正在使用仍然使用旧的@asyncio.coroutine
装饰器的第三方库,并正在生成有关导入的警告。我认识到这将在未来版本的Python中破坏。但是目前,我们只想关闭此警告,以免用户垃圾邮件。
我已经尝试了我能想到的一切来使这个沉默的一切,包括每个答案,甚至关闭所有折旧警告:
warnings.filterwarnings("ignore", category=DeprecationWarning)
from pymodbus.client.asynchronous.async_io import (
BaseModbusAsyncClientProtocol,
ReconnectingAsyncioModbusTcpClient,
ReconnectingAsyncioModbusTlsClient,
)
似乎没有任何东西使它保持沉默。
We're using a third party library which still uses the old @asyncio.coroutine
decorator and is generating a bunch of warnings on import. I recognise this will break in future versions of python. But for now we just want to turn off this warning so that it doesn't spam the user.
I've tried everything I can think of to silence this including every answer here and even turning off all depreciation warnings:
warnings.filterwarnings("ignore", category=DeprecationWarning)
from pymodbus.client.asynchronous.async_io import (
BaseModbusAsyncClientProtocol,
ReconnectingAsyncioModbusTcpClient,
ReconnectingAsyncioModbusTlsClient,
)
Nothing seems to silence it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论