sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #43927
[Question #658613]: issues when using Python logging module in sikuli
New question #658613 on Sikuli:
https://answers.launchpad.net/sikuli/+question/658613
Hi all,
i have issues when using Python logging module in sikuli
run following script in sikuli ide :
import logging
# when run in IDE with reruns to avoid errors use
import logging; reload(logging)
#create a new logging instance
logger = logging.getLogger("MyLogger")
#set the file to log to
logger.addHandler(r"D:\\TestingReports\\file.log")
#set the logging level, DEBUG is the most verbose level
logger.setLevel(logging.DEBUG)
logger.info("We are starting now")
def functionInMyScript():
logger.debug("entering functionInMyScript()")
# do something that might fail
print("run function success!!")
logger.debug("leaving functionInMyScript()")
try:
functionInMyScript()
logger.debug("Function call succeeded")
except:
logger.error("Function call failed")
but i get error:
[error] script [ log_1 ] stopped with error in line 15
[error] AttributeError ( 'str' object has no attribute 'level' )
[error] --- Traceback --- error source first line: module ( function ) statement 1319: __init__ ( callHandlers ) if record.levelno >= hdlr.level:
1280: __init__ ( handle ) self.callHandlers(record)
1270: __init__ ( _log ) self.handle(record)
1151: __init__ ( info ) self._log(INFO, msg, args, **kwargs)
[error] --- Traceback --- end --------------
What should i do ?
thanks for the help!
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.