← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #281134]: openApp failed file not found

 

Question #281134 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/281134

hakim johari gave more information on the question:
thanks I found how to do the logging feature but I got an error with the
script

this is my script:

import logging; reload(logging)

#create a new logging instance
logger = logging.getLogger("MyLogger")

#set the file to log to
logger.addHandler(r"Z:\UiTM\fyp\automation test\logging\test.log") 
**For this I cannot use fileHandler because it says that the [error] AttributeError ( 'Logger' object has no attribute 'fileHandler' ) and that is why I use addHandler**

#set the logging level, DEBUG is the most verbose level
logger.setLevel(logging.DEBUG)

logger.info("We are starting now") **This is where the error are**

find("afalwearBase-1.JPG")
hover("collectionWhite-2.JPG")
exists("collectionRed.JPG")


def functionInMyScript():
     logger.debug("entering functionInMyScript()")
     # do something that might fail
     hover("collectionWhite-2.JPG")
     exists("menRed.JPG")
     logger.debug("leaving functionInMyScript()")

try:
    functionInMyScript()
    logger.debug("Function call succeeded")
except:
    logger.error("Function call failed") **And also here**


Error for both is:

[error] AttributeError ( 'str' object has no attribute 'level' )
[error] --- Traceback --- error source first line: module ( function ) statement 1280: __init__ ( handle ) File "C:\Users\Papa\Downloads\sikulix.jar\Lib\logging\__init__.py", line 1319, in callHandlers
1177: __init__ ( error ) File "C:\Users\Papa\Downloads\sikulix.jar\Lib\logging\__init__.py", line 1270, in _log
[error] --- Traceback --- end --------------

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.