title: Retrieving responses from a JSON File
body: <p>I'm trying to pull some values out of an JSON file but it doesn't seem to be working.  Additionally, when I try to add print statements to see where it is blowing up, nothing prints.  Can anyone see any glaring reason why this isn't working?  The only thing I can think of is that it has something to do with the fact that I recently switched from a PC to a Mac and the files are stored as rtf's rather than txt's.  </p>
  
  <pre><code>import glob2
  import json
  
  fdr = glob2.glob('/Users/Lab-Justin/Desktop/CogStylesText/TextFiles/*.rtf')    #insert all rtf files in folder into list
  
  for dr in fdr:        #loop through file list
      print(dr)
      ending = str(dr[57:])     #cut filename from pathname
      pe = ending.replace('.rtf', '')    #add filename to path
      f_quest = '/Users/KraemerLab-Justin/Desktop/CogStylesText/CogStylesExcel/QuestEx/' + pe + '.csv'     #format the file as csv
      f_n = '/Users/Lab-Justin/Desktop/CogStylesText/TextFiles/' + pe            #access rtf file
      print(f_n)
  
      file_path = 'f_n'
      file_out = 'f_quest'
      with open(file_path) as f_in, open(file_out) as f_out:
          data = json.load(f_in)
      print(data.keys())  # list the dicts keys
  
      q = 'vviq'
      response = data[q]['response']
      f_out.write('response')    #write responses to new .csv file
  </code></pre>