0

I am trying to use pdf2image, but I am getting this error:

PDFPageCountError: Unable to get page count.
I/O Error: Couldn't open file 'C:\Users\user_name\Desktop\folder_name\folder2_name\folder3_name\007-084841-1 to 31 Dec'22': No error.

It is confusing as it doesn't give any error, it just says 'No error'

My code is:

doc = convert_from_path("C:\\Users\\user_name\\Desktop\\folder_name\\folder2_name\\folder3_name\\007-084841-1 to 31 Dec'22")
path, fileName = os.path.split("C:\\Users\\user_name\\Desktop\\folder_name\\folder2_name\\folder3_name\\007-084841-1 to 31 Dec'22")
fileBaseName, fileExtension = os.path.splitext(fileName)

for page_number, page_data in enumerate(doc):
    txt = pytesseract.image_to_string(Image.fromarray(page_data)).encode("utf-8")
    print("Page # {} - {}".format(str(page_number),txt))

Can anyone help me please?

I don't know what to try as the error message just says Unable to open...: No error

Adriaan
  • 17,741
  • 7
  • 42
  • 75
CrisD
  • 1
  • 1
  • Please remember that Stack Overflow is not your favourite Python forum, but rather a question and answer site for all programming related questions. Thus, please always include the tag of the language you are programming in, that way other users familiar with that language can more easily find your question. Take the [tour] and read up on [ask] to get more information on how this site works, then [edit] the question with the relevant tags. Also read [Why is "Can someone help me?" not an actual question?](https://meta.stackoverflow.com/q/284236/5211833) – Adriaan Jan 11 '23 at 15:24

0 Answers0