← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #210536]: Error message when using import: 'with' will become a reserved keyword in Python

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Do just what it says:
- HOW TO FIX? Try adding "from sikuli import *" in the module.

So this means - might not be that clear :-(  -  you have to add
from sikuli import *

to every IMPORTED module that uses Sikuli features  (so to MyLib.sikuli
in your case).

See docs: http://sikuli.org/docx/globals.html#importing-other-sikuli-
scripts-reuse-code-and-images

BTW: def initApp(self):
as a convention in Python self is only used with function definitions in classes (aka methods) as the parameter cobntaining the reference to the current object.

So if you want to use initApp with a parameter use another name.

e.g.
def initApp(path):
    anyapp = App.open(path)
    with Region(lookapp.window()):
        # do something

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.