小编Nat*_*tan的帖子

Ansible:(ansible.legacy.command)模块不支持的参数:警告

今天我遇到了 Ansible playbook 的旧部分失败的情况:

现在的情况

- name: Install something
  shell: somecomand
  args:
    warn: false
Run Code Online (Sandbox Code Playgroud)

这会抛出致命错误:

"msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: chdir, _raw_params, removes, stdin, argv, executable, strip_empty_ends, stdin_add_newline, creates, _uses_shell."
Run Code Online (Sandbox Code Playgroud)

显然warn不再支持。我试图找到忽略警告的“新”方法,但我发现的所有内容都将我引向旧warn: false方法。

问题

忽略警告的“新”方法是什么?或者 - 如果想到更好的方法:解决此问题?

Ansible版本

pip show ansible
Name: ansible
Version: 7.0.0
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: info@ansible.com
License: GPLv3+
Location: /usr/local/lib/python3.10/dist-packages
Requires: ansible-core
Required-by:
Run Code Online (Sandbox Code Playgroud)

相同的剧本在以下情况下运行没有问题:

pip show ansible
Name: ansible
Version: 6.6.0 …
Run Code Online (Sandbox Code Playgroud)

ansible

12
推荐指数
1
解决办法
2万
查看次数

在 Ubuntu 20.04 上安装 libgtk-3-dev

我想用cpp写一个GUI。据我所知,gtk 是一个很好的解决方案。遗憾的是,在我看来 gtk 在 Ubuntu 20.04 下不再可用。(如果这很重要,我正在使用 Xubuntu)

执行:sudo apt install libgtk-3-dev

导致:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgtk-3-dev …
Run Code Online (Sandbox Code Playgroud)

c++ gtk user-interface apt-get ubuntu-20.04

8
推荐指数
1
解决办法
2万
查看次数

BS4 replace_with 结果不再在树中

我需要替换 html 文档中的多个单词。Atm 我通过为每次替换调用一次 replace_with 来做到这一点。在 NavigableString 上调用 replace_with 两次会导致 ValueError(见下面的例子),因为被替换的元素不再在树中。

最小的例子

#!/usr/bin/env python3
from bs4 import BeautifulSoup
import re
def test1():
  html = \
  '''
    Identify
  '''
  soup = BeautifulSoup(html,features="html.parser")
  for txt in soup.findAll(text=True):
    if re.search('identify',txt,re.I) and txt.parent.name != 'a':
      newtext = re.sub('identify', '<a href="test.html"> test </a>', txt.lower())
      txt.replace_with(BeautifulSoup(newtext, features="html.parser"))
      txt.replace_with(BeautifulSoup(newtext, features="html.parser"))
      # I called it twice here to make the code as small as possible.
      # Usually it would be a different newtext ..
      # which was created …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup replacewith

7
推荐指数
1
解决办法
186
查看次数

如何使用 python 或 CL 将文件复制到剪贴板,然后使用 STRG+V 粘贴它?

我正在尝试将文件复制(使用 python 或 CL 命令,然后可以使用 python 调用)到剪贴板,以便稍后使用 STRG+V 粘贴它。据我了解,文件不会“移动”到剪贴板中,而是剪贴板保存路径和告诉操作系统“这是一个文件”的参数/标志。我对 Linux 特定的答案很满意,但通用的答案将是最重要的。

pyperclip

不是一个解决方案,因为它不允许复制文件,只能复制字符串。

剪辑

不是一个解决方案,因为它只复制文本

xclip-复制文件

不是一个解决方案,因为它只复制到X剪贴板,而不是剪贴板。虽然 xclip 提供了该选项-selection clipboard(但仅复制文本),xclip-copyfile但没有这样的选项。

使用查找

find ${PWD} -name "*.pdf"| xclip -i -selection clipboard -t text/uri-list

是此处描述的命令: https: //askubuntu.com/questions/210413/what-is-the-command-line-equivalent-of-copying-a-file-to-clipboard#answer-210428

但我无法用它复制文件,因此假设它不适用于所有文件。

python linux clipboard ubuntu xfce

6
推荐指数
1
解决办法
2120
查看次数