AlJohri / docx2pdf

MIT License
506 stars 96 forks source link

convert fails silently if the docx file is malformed or nonexistent #55

Closed jftsang closed 2 years ago

jftsang commented 2 years ago

Attempt to run convert() on a corrupted docx file convert('/tmp/empty_file.docx') or a docx file that doesn't exist: convert('/tmp/this_file_doesnt_exist.docx'). You just get nothing back: no indication that the conversion has failed. It would be more sensible to throw an exception in this case. As a workaround I have to test whether the expected file exists, but this is not a good test if the target file might already exist and hasn't been updated.

AlJohri commented 2 years ago

thanks for the issue @jftsang, can you share which OS you're using? the implementations slightly differ.

jftsang commented 2 years ago

@AlJohri I am on MacOS.

(venv39) jmft2@aerosol:~$ uname -a
Darwin aerosol.QLOCOM 18.7.0 Darwin Kernel Version 18.7.0: Tue Jun 22 19:37:08 PDT 2021; root:xnu-4903.278.70~1/RELEASE_X86_64 x86_64
jftsang commented 2 years ago

Ah - I dug into the file, and, as a separate issue, I noticed that I don't have Microsoft Word on my machine! So I should first address that...

jftsang commented 2 years ago

I'm closing this issue but raising a separate one to do with Microsoft Word not being present. The problem is the same, an exception ought to be raised.

jftsang commented 2 years ago

56