AlJohri / docx2pdf

MIT License
506 stars 96 forks source link

convert a whole folder to pdf drops error #9

Closed frondoto closed 1 year ago

frondoto commented 4 years ago

hi, im just using this two lines in the whole script

from docx2pdf import convert

convert("encontrados/")

and the library converts a random ammount of .docx to .pdf and drops this error

com_error: (-2147418111, 'La llamada fue rechazada por el destinatario.', None, None)

i've tried using different versions of the library and it still doing the same. Do you think its a library issue? Thanks

AlJohri commented 4 years ago

@frangamba I tried googling com_error: (-2147418111 and seems like it might be related to having a file/folder open. can you check if you have explorer or word open?

Burd89 commented 4 years ago

Similar error here "com_error: (-2147352567, 'Er is een uitzondering opgetreden.', (0, 'Microsoft Word', 'The file appears to be corrupted.', 'wdmain11.chm', 25272, -2146822496), None)".

Closing explorer did not help.

AlJohri commented 4 years ago

@Burd89 I think that's a slightly different error as it says "The file appears to be corrupted". Does the file open in MS Word normally? Do you get that same error (w/ same error code) with using a different file?


Leaving a note for myself to check when I'm back on my windows laptop:

import win32api
print(win32api.FormatMessage(-2147418111))
print(win32api.FormatMessage(-2147352567))

ref: https://stackoverflow.com/questions/36064723/pywintypes-com-error-2147352567-exception-occurred-0-none-none-none

Burd89 commented 4 years ago

The files open normally in word. I only get the error when converting the whole folder. No errors are given when converting the files separately. Which is fine for now

ayushkoul33 commented 3 years ago

File "<COMObject >", line 8, in Open pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Word', 'The file appears to be corrupted.', 'C:\Program Files (x86)\Microsoft Office\Office12\1033\WDMAIN11.CHM', 25272, -2146822496), None)

For Separate conversion of single docx file ,I am getting the above error of file is corrupted.. how to fix it??