0

I'm trying to combine several pdf files into one, but when I use my function, through a tkinter button to merge the files, it gives me a Permission error.

This is the error:

return self.func(*args)
File "D:\Visual Studio projects\PDFCOMBINER.py", line 80, in pdfBinder
merger.append(self.path, pdf)
fileobj = file(fileobj, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:/Users/milli/Desktop'

I have tried some different ways on calling the path and tried to changes the security permissions on the folders I want to write to, but no luck yet.

Here is the function as it is now:

def pdfBinder(self):
    self.user = os.getlogin()
    self.path = str("C:/Users/") + self.user + str("/Desktop")

    merger = PdfFileMerger()

    for pdf in self.fileContent:
        merger.append(self.path, pdf)
    if not os.path.exists("result.pdf"):
        merger.write("result.pdf")
    merger.close()

TIA

Math
  • 141
  • 2
  • 16
  • looks for me like a path problem that you are not able to oben the pdf files becouse the path from pdf is wrong ? `'C:/Users/milli/Desktop'` this is no PDF path like `'C:/Users/milli/Desktop/xyz.pdf'`? – Fabian Apr 21 '19 at 09:31
  • You need a raw input prefix string ( `r` ) to open the file before you give the path. check this post https://stackoverflow.com/questions/13207450/permissionerror-errno-13-in-python – Saad Apr 21 '19 at 09:33

0 Answers0