当前位置: 代码迷 >> 综合 >> ansible playbook with open(module, ‘wb‘) as f:\r\n ^\r\nSyntaxError: invalid syntax\r\n“
  详细解决方案

ansible playbook with open(module, ‘wb‘) as f:\r\n ^\r\nSyntaxError: invalid syntax\r\n“

热度:12   发布时间:2023-12-16 01:39:28.0

在执行ansible palybook时出现了以下报错:

"changed": false, "module_stderr": "Shared connection to 192.168.166.85 closed.\r\n", "module_stdout": "  File \"/root/.ansible/tmp/ansible-tmp-1557400333.44-113544688602620/AnsiballZ_stat.py\", line 40\r\n    with open(module, 'wb') as f:\r\n            ^\r\nSyntaxError: invalid syntax\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1

后来查了一下发现target machine的python版本是2.4,需要升级到2.7,否则就会出现语法错误。

  相关解决方案