python3 RuntimeWarning:二进制模式不支持行缓冲(buffering=1),将使用默认缓冲区大小

Mic*_*icz 5 apt python3 20.04

我最近从更新我的Ubuntu19.1020.04。在安装过程中,现在当我运行时,apt update我看到与 python 相关的警告:

/usr/lib/python3.8/subprocess.py:838: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used self.stdin = io.open(p2cwrite, 'wb', bufsize)
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

小智 4

在这里,您可以看到有关此问题的讨论:

这里有一个修复:

但请记住...这不是一个错误,而是一个功能:)


Vla*_*tka 0

我在20.4中使用“apt update”没有这样的问题

shell> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
Run Code Online (Sandbox Code Playgroud)

就我而言,问题是由 Ansible 插件mitogen引起的

shell> ansible-playbook --version
ansible-playbook 2.9.6
  config file = /home/admin/.ansible.cfg
  configured module search path = ['/home/admin/.ansible/my_modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

shell> ansible localhost -m setup
Run Code Online (Sandbox Code Playgroud)

/usr/lib/python3.8/os.py:1023: RuntimeWarning: 二进制模式下不支持行缓冲 (buffering=1),将使用默认缓冲区大小 return io.open(fd, *args, * *夸格斯)

当我禁用有丝分裂原后,问题就消失了

shell> grep strategy ansible.cfg 
# strategy = mitogen_linear
Run Code Online (Sandbox Code Playgroud)