title: Python: convert pdf to csv/json
body: <p>I am new Python with converting files. I am trying to convert pdf to csv in this code and I am referring this git repo: <a href="https://github.com/bhishan/PDFMiningUsingLessAndSubprocess" rel="nofollow noreferrer">https://github.com/bhishan/PDFMiningUsingLessAndSubprocess</a> </p>
  
  <p>I am getting error like "failed for file A Test Suite for Evaluation of English-to-Korean.pdf". Everything is working fine except 'subprocess.Popen'. What am I doing wrong here? </p>
  
  <p>PDF file link (unable to add attachment on the git): <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.503.4016&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.503.4016&amp;rep=rep1&amp;type=pdf</a></p>
  
  <pre><code>import subprocess
  import glob
  import time
  import csv
  
  csvwriter = csv.writer(file('translation.csv', 'wb'))
  csvwriter.writerow(['title','contributornames','institutions','abstract'])
  
  def parse_pdf_buffer(buffer_file):
      with open(buffer_file, 'rb') as f:
          all_content = f.readlines()
          for each_line in all_content[0:29]:
              title_part = each_line[0]
              contributornames = each_line[1]
              institutions = each_line[1:3]
              abstract = each_line[7:27]
              title_part = " ".join(desc_part.split())
              contributornames_part = " ".join(withdraw_part.split())
              institutions_part = " ".join(desc_part.split())
              abstract_part = " ".join(desc_part.split())
              csvwriter.writerow(['title','contributornames','institutions','abstract'])
  
  def read_pdf_file(file_name):
     print file_name
     try:
         fileptr = open('koreanenglish_extracted.txt', 'wb') #parsed it from different code
         command_out = subprocess.Popen(['less', file_name], stdout=fileptr, stderr=subprocess.STDOUT) #ERROR occurs here
         time.sleep(2)
         parse_pdf_buffer('koreanenglish_extracted.txt') #parsed it from different code 
     except:
         print "failed for file", file_name
  
  def main():
     for file_name in glob.glob("*.pdf"): #capture all the pdf
         read_pdf_file(file_name)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>FortunatoScienceParsed.txt contents: copy paste in txt. Sorry I could not upload the files as the attachment. I"ll the send entire koreanenglish_extracted.txt in chat if needed. Help is greatly appreciated!!!</p>
  
  <pre><code>A Test Suite for Evaluation of English-to-Korean Machine Translation Systems
  Sungryong Koh, Jinee Maeng, Ji-Young Lee, Young-Sook Chae, Key-Sun ChoiKorea Terminology Research Center for Language and Knowledge Engineering (KORTERM)
  Korea Advanced Institute of Science and Technology (KAIST) 
  Kusong-dong Yusong-gu Taejon 305-701 Korea
  {koh,aphroditejin,jinny206}@world.kaist.ac.kr
  , pinochae@chollian.net
  , kschoi@cs.kaist.ac.kr
  Abstract
  This paper describes KORTERM™s test suite and their practicability.
   The test-sets have been being constructed on the basis of f
  ine-
  grained classification of linguistic phenomena 
  to evaluate the technical st
  atus of English-to-Korean 
  MT systems systematically.
   They
  consist of about 5000 test-sets and are growi
  ng.  
  </code></pre>