Loguru报错TypeError: a ContextVar key was expected, got <ContextVar name=‘loguru_context‘ default={}

百度搜索完全搜不到类似的问题,中文的技术文章清一色的复制粘贴,只能看到loguru的介绍文章,只能到外网查查看。

git上看到有说是 monkey.patch_all() 的问题。

Hi. Problems of compatibility with gevent are not new, see #258.

As the error message mentions contextvars, did you try calling monkey.patch_all(contextvars=False) instead?

 然后有开发者回复了给参数加上 contextvars=False ,问题迎刃而解。

Another possibility is to import loguru after having called monkey.patch_all().

For Python < 3.7, Loguru depends on the contextvars library which perform some sanity checks for types (which therefore is not the one expected if ContextVar is patched by gevent).

另外有说先patch完再import loguru 包,也可以试一下看看。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值