How to run PyPdf2 fileMerger within a shared folder on a network drive

189 views Asked by At

I am trying to merge multiple files using PyPDf2 within a folder in my office's shared drive. However, my program never finishes running because I believe that it does not have permission to access the folder. Is there a way to allow access to it?

from PyPDF2 import PdfFileMerger
import os

path = "H:\\Accounting\\ME\\Attachments\\Pdf"
pdf_files = ["\\file1.pdf", "\\file2.pdf"]
merger = PdfFileMerger()
    for files in pdf_files:
        merger.append(path + files)
    if not os.path.exists(path + "\\newMerged.pdf"):
        merger.write(path + "\\newMerged.pdf")
merger.close()
print("done")
0

There are 0 answers