FeXd / saskwildfire

A bot to propogate wildfire information in Saskatchewan. https://twitter.com/SaskWildfire
MIT License
1 stars 0 forks source link

pdf2image ValueError #5

Closed FeXd closed 2 years ago

FeXd commented 3 years ago
Traceback (most recent call last):
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 479, in pdfinfo_from_path
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arlin/Git/saskwildfire/main.py", line 92, in <module>
    generate_images_from_pdf('./pdf/', item['pdf'], './image/')
  File "/Users/arlin/Git/saskwildfire/main.py", line 51, in generate_images_from_pdf
    images = convert_from_path(in_path+pdf)
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 98, in convert_from_path
    page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 488, in pdfinfo_from_path
    raise PDFPageCountError(
pdf2image.exceptions.PDFPageCountError: Unable to get page count.
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
FeXd commented 3 years ago

It happened again. Ohno.

2021-10-06T22:00:05Z: PDF is different:  MunicipalFireBans.pdf 
Traceback (most recent call last):
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 479, in pdfinfo_from_path
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arlin/Git/saskwildfire/main.py", line 92, in <module>
    generate_images_from_pdf('./pdf/', item['pdf'], './image/')
  File "/Users/arlin/Git/saskwildfire/main.py", line 51, in generate_images_from_pdf
    images = convert_from_path(in_path+pdf)
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 98, in convert_from_path
    page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
  File "/Users/arlin/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pdf2image/pdf2image.py", line 488, in pdfinfo_from_path
    raise PDFPageCountError(
pdf2image.exceptions.PDFPageCountError: Unable to get page count.
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table