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