The code is:
import sys
execfile('test.py')
In test.py I have:
import zipfile
with zipfile.ZipFile('test.jar', 'r') as z:
z.extractall("C:\testfolder")
This code produces:
AttributeError ( ZipFile instance has no attribute '__exit__' ) # edited
The code from "test.py" works when run from python idle. I am running python v2.7.10
__exit__
, the error in the question saysextractall
, which one is relevant? – Nihitest.py
directly? Also you should either add a second backslash or user"C:\testfolder"
to avoid\t
being a tab character. – Manche