Closed duskybomb closed 6 years ago
I'm aware. The sample code was just a sample.
There should still a better error message when the input file doesn't exist.
As I said there need to be some checks to see:
My observations:
isinstance(pdf_invoice, str) and pdf_invoice.endswith('.pdf') and os.path.isfile(pdf_invoice)
isinstance(pdf_invoice, file_types)
isinstance(pdf_invoice, str)
Hence I added a commit (#18) to raise FileNotFoundError
in second condition: isinstance(pdf_invoice, str)
Cool. To put the icing on the cake you could also make a test that triggers this exception. Would be a good habit to always do feature + test together. Else tests generally get neglected.
If there is no pdf named
inv2.pdf
in the directory