파이썬 모듈 직접 터미널에서 실행하면 파이썬 스크립트가 하나 있지만, 나는 똑같은 스크립트를 사용할 수 있지만 아래에있을 때 사용하고 있습니다. 오류."ImportError : xhaus라는 모듈 없음"
Ansible 명령은 다음과 같습니다
- name: run installer command 2
command: "{{auto_inst_loc}}/installer.py -i -s -c"
register: command_result2
- debug: msg="{{command_result2.stdout}}"
- debug: msg="{{command_result2.stderr}}"
그리고 command_result2.stderr는이 문제를 해결하기 위해 도와주세요
"msg": "Traceback (most recent call last):\n
File \"../scripts/Lib/soa/automation/containerManager.py\", line 9, in
<module>\n from apicontainer import constants, common\n File
\"/opt/akana_sw/sm8/scripts/Lib/soa/automation/apicontainer/common.py\",
line 10, in <module>\n from com.xhaus.jyson import JysonCodec as
json\nImportError: No module named xhaus"
입니다.
편집 : 실제로 누락 된 모듈 (xhaus)은 JAR 파일이며 Python 스크립트 파일이있는 경로와 같은 경로에 있습니다. JAR 파일을 CLASSPATH에 추가해야하는 곳이 어디 있습니까?
'command' 대신'shell' 모듈을 사용해보십시오. 운이 없다면 사용자/불가능한 환경의 차이를 조사하십시오. –