defhandleWalkError(err): print'Error When Access ', err.filename print err
deffindJarInDir(dir_root, className): classPath = mapToFile(className) for root, dirs, files in os.walk(dir_root, onerror=handleWalkError): ifnot files: continue for f in files: if f.lower().endswith('.jar'): fpath = os.path.join(root, f) with zipfile.ZipFile(open(fpath, 'rb')) as zf: if classPath in zf.namelist(): print fpath