Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pdfinfo_from_path_invalid(self):
start_time = time.time()
try:
info = pdfinfo_from_path("./tests/test.jpg")
raise Exception("This should not happen")
except PDFPageCountError:
pass
print("test_pdfinfo_from_path_241: {} sec".format(time.time() - start_time))
int(value.strip())
if key in PDFINFO_CONVERT_TO_INT
else value.strip()
)
if "Pages" not in d:
raise ValueError
return d
except OSError:
raise PDFInfoNotInstalledError(
"Unable to get page count. Is poppler installed and in PATH?"
)
except ValueError:
raise PDFPageCountError(
"Unable to get page count.\n%s" % err.decode("utf8", "ignore")
)