title: For loop and crop pdfs in reticulate does not work
body: <p>I tried to run this python script in R Studio in a python script, somehow it just takes the second &quot;path2.pdf&quot; pdf file and crops this and not the first. If I change the order of the files variable it crops &quot;path1.pdf&quot;. With Jupyter Notebooks everything works as expected. Can anyone help?</p>
  <pre><code>
  import PyPDF2
  from PyPDF2 import PdfFileReader, PdfFileWriter
  
  
  files = [&quot;path1.pdf&quot; , &quot;path2.pdf&quot;]
  
  # crop all pdfs in folder
  for filepath in files:   
      pdfFileObj = open(filepath, 'rb')
      # read the pdf object
      pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
      # create pdf writer object
      writerObj = PdfFileWriter()
  
      page = pdfReader.getPage(0)
      print(page.cropBox.getLowerLeft())
      print(page.cropBox.getLowerRight())
      print(page.cropBox.getUpperLeft())
      print(page.cropBox.getUpperRight())
      page.cropBox.setLowerLeft((31, 20))
      page.cropBox.setLowerRight((190, 20))
      page.cropBox.setUpperLeft((31, 95))
      page.cropBox.setUpperRight((190, 95))
      # Write the new page
      writerObj.addPage(page)
      # Create an output pdf
      outstream = open(filepath, 'wb')
      writerObj.write(outstream)
      outstream.close()
  </code></pre>