← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #271968]: How can I avoid: “ZipFile instance has no attribute '__exit__''” when extracting a zip file?

 

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

george munteanu posted a new comment:
Hi,


I have tried:
z = zipfile.ZipFile('test.jar', 'r')
z.extractall(r"C:\testfolder")
This returns: ( ZipFile instance has no attribute '__extractall__' )

That's I am running now sikuli x 1.1.0.
But if I use: extractall, the system returns: 
line: module ( function ) statement
1059: zipfile (  _extract_member ) TypeError: character mapping must return integer, None or unicode


Solution: I have altered: zipfile.py inside sikulix.jar.
At line 1057, 1058, 1059 I have written:
 table = string.maketrans(illegal, '_' * len(illegal))
 table = table.decode("latin-1")
 arcname = str(arcname.translate(table))


Maybe this will help others.
Take care

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