← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Hi,

I get this error when using 'import' and 'with':
ImportError: Errors in loading sikuli module: lib_base_Init
'with' will become a reserved keyword in Python 2.6 (lib_base_Init.py, line 11)
 - HOW TO FIX? Try adding "from sikuli import *" in the module.

Environment:
- Mac OS X 10.7.4
- Sikuli X-1.0rc3 (r905)
- When typing "python" in the console:
  Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin

My code:
------------------------------
MyTest.sikuli:
import MyLib

MyLib.sikuli:
def initApp(self):
    anyapp = App.open("/../AnyApp.app")
    with Region(lookapp.window()):
        # do something
------------------------------

I've run the code from the IDE and from commandline. Always the same error message.
When using the 'with' statement within the same file (MyTest.sikuli in my case) then the code works fine. The import works fine without using 'with'.

I've made some tests on my code (unsuccessfully):
MyTest.sikuli:
from __future__ import with_statement
from sikuli.Sikuli import *
from sikuli import *
import MyLib

I've found those two directories, but I'm not sure if Sikuli uses them:
/Developer/Applications/Utilities/Python 2.6
/Developer/Applications/Utilities/MacPython 2.5


Any ideas?

Thanks in advance,
Jan


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