title: .jar integration in python
body: <p>I am accessing a java jar in my python program to get metadata of images.I have around 90000 images in my folder.For each images I need to use the jar and get data from it.Currently I have coded as below which work completely file for 10 images.But it is really slow when I have a lot of images.My code is as follows</p>
  
  <pre><code>def jarWrapper(*args):
      process = Popen(['java', '-jar']+list(args), stdout=PIPE, stderr=PIPE)
      ret = []
      while process.poll() is None:
          line = process.stdout.readline()
          if line != '' and line.endswith('\n'):
              ret.append(line[:-1])
      stdout, stderr = process.communicate()
      ret += stdout.split('\n')
      if stderr != '':
          ret += stderr.split('\n')
      ret.remove('')
      return re
  
  def main():
      listofkeys =['Content-Length','Image Height','Image Width']
      hashvaludict ={}
  
      for dirpath, dirs, files in os.walk('/Users/akira/Documents/LiClipseWorkspace/cnf/duplicate_image'):
  
          files = [fi for fi in files if not fi.startswith(".DS_Store")]
          files = sorted(files)
          for filename in files:
              listofcontentvalue =[]
              args = ['/Users/akira/tika-app-1.10.jar','-m' ]
              args.append(os.path.join(dirpath, filename))
              #print args
              result = jarWrapper(*args)
  
  main()
  </code></pre>
  
  <p>Please suggest me a way in which I can make this process faster.</p>