def zipdir(path, zip_file):
 try:
  print '[INFO] Zipping'
  for (root, _sub_dir, files) in os.walk(path):
   for file_name in files:
    zip_file.write(os.path.join(root, file_name))
 except:
  PrintException('[ERROR] Zipping')

def zipdir ( path , zip_file ) : try : print '[INFO] Zipping' for ( root , _sub_dir , files ) in os . walk ( path ) : for file_name in files : zip_file . write ( os . path . join ( root , file_name ) ) except : PrintException ( '[ERROR] Zipping' )
zip a directory .