I have a python script called mypython.py which has a logger module imported. The mypython.py is called from an expect script called myexpect.exp. My issue is when I add a logger.info('test') statement in mypython.py and call it from myexpect.exp then the myexpect.exp fails. If I replace the logger.log('test') statement with print statement then it is working fine.
Content of python script
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
Content of Expect Script
#!/usr/bin/expect --
#exec python mypath/stratus/bin/mypython.py "test" ">@stdout"
exec python prnt_stmt.py -t arg_from_exp ">@stdout"
Error which i got
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)
Can anyone help me out in this?