← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #271968]: Windows: How to avoid: “ZipFile instance has no attribute '__exit__''” with module zipfile? --- use version 1.1.0 (includes Jython 2.7)

 

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

Description changed to:
***************** workaround/alternative *************
after 2015-10-02 this new feature is available:

unzip(sourceFile, targetFolder)

unzips the content to targetFolder while preserving a zipped folder structure 
 (implemented using the Java builtin support for zip-files)

... also unzips jar files

------------------------------------------------------------------------------------------------------------

[1] 
The structure is: .bat file triggers  a .py file
The bat file reads: start /i /b /wait C:\Sikuli\Downloads\runIDE.cmd -r "C:\automat\end2end.sikuli"
The code inside .py is :
import zipfile
with zipfile.ZipFile('test.jar', 'r') as z:
    z.extractall(r"C:\testfolder")

This code produces:
AttributeError ( ZipFile instance has no attribute '__exit__' ) 


[2]
note: The code from "test.py" works when run from python idle. I am running python v2.7.10
note: Other methods (that i tried) from zip module do not return any issues.


[3]
Full stack trace:
Exception in thread "main" java.lang.IllegalStateException: No match found
        at java.util.regex.Matcher.group(Matcher.java:485)
        at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSourceWalkTrace(JythonScriptRunner.ja
va:326)
        at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSource(JythonScriptRunner.java:290)
        at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunner.java:200)
        at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:162)
        at org.sikuli.basics.SikuliScript.main(SikuliScript.java:181)
        at org.sikuli.ide.SikuliIDE.main(SikuliIDE.java:212)



@ edit : 
hmm. I believed I found the cause. when running "import sys print sys.version" using the structure mentioned above I get: 2.5.4rc1 (2.5:723492dbab02, Feb 8 2013, 10:13:55) . In python default idle I get: 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)]


Therefore, please tell me,  how can I get sikuli to recognize 2.7.10 ?


Take care

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