← 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: Answered => Solved

Jan confirmed that the question is solved:
Hi RaiMan,

thanks for the quick answer! Sorry, I forgot to mention that I've tried
that too.

But I've implemented your suggestions and removed the 'self' AND I added
"from __future__ import with_statement" in the included file
(MyLib.sikuli in my case).

That worked!

Source:
----------------------------
MyTest.sikuli:
import MyLib
MyLib.initApp()

MyLib.sikuli:
from __future__ import with_statement
from sikuli import *

def initApp():
    anyapp = App.open("/Applications/TextEdit.app")
    with Region(anyapp.window()):
        popup('it worked')
----------------------------

As I don't know anything about python, I have no clue if the additional
statement "from __future__ import with_statement" comes with any
drawbacks ...


Jan

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