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