2
로거 모듈을 가져온 mypython.py라는 python 스크립트가 있습니다. mypython.py는 myexpect.exp라는 expect 스크립트에서 호출됩니다. 내 문제는 mypython.py에 logger.info ('test') 문을 추가하고 myexpect.exp에서 호출하면 myexpect.exp가 실패합니다. logger.log ('test') 문을 print 문으로 대체하면 올바르게 작동합니다. 내가예상 스크립트에서 파이썬 스크립트를 호출 할 때 오류가 발생했습니다.
This is from print statement arg_from_exp
03/06/2014 03:16:55 AM This is from logger statement arg_from_exp
while executing
"exec python mypython.py -t arg_from_exp ">@stdout""
(file "./myexpect.exp" line 9)
이 사람이 나를 도울 수있어 기대 스크립트
#!/usr/bin/expect --
#exec python mypath/stratus/bin/mypython.py "test" ">@stdout"
exec python prnt_stmt.py -t arg_from_exp ">@stdout"
오류의 파이썬 스크립트의
내용
import os
import sys
import datetime
import time
import argparse
import logging
logging.basicConfig(format="%(asctime)s %(message)s",
datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.INFO)
logger = logging.getLogger(__name__)
***
***
def main():
args = get_args()
print 'This is from print statement ' + args.test_arg ### This is OK
logger.info("This is from logger statement" + " " + args.test_arg) ### This has issue
내용?
왜 당신은 파이썬에서 모든 것을 쓰지 않는다? – Keith