Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range in export_image function when accessing filters[-1][0] due to an empty or improperly structured filters list. #1052

Open
vanshika-panwar opened this issue Oct 21, 2024 · 2 comments

Comments

@vanshika-panwar
Copy link

Bug report

  • encountered an IndexError in the export_image function of pdfminer, specifically in this line:
    if filters[-1][0] in LITERALS_DCT_DECODE:
  • The error occurs when attempting to access filters[-1][0], which fails when filters is either empty or not structured as expected. Please investigate if there should be additional checks to handle these cases gracefully.

Traceback

Traceback (most recent call last):\n File "/usr/src/python-app/processor/pdf_processor.py", line 114, in __get_image_raw_data\n file_name = image_writer.export_image(image=image)\n File "/opt/conda/envs/env/lib/python3.9/site-packages/pdfminer/image.py", line 108, in export_image\n if filters[-1][0] in LITERALS_DCT_DECODE:\nIndexError: list index out of range

Screenshot 2024-10-21 at 11 08 47 AM

attaching the pdf used
vietnam.pdf

@pietermarsman please review

@KaboChow
Copy link

to fix your trouble check this solution click maybe this will solve your problem.

This is a malicious link. Do not click it. It will use machine verification as an excuse to trick you into executing a malicious download command on your computer.

If you have already executed it, you can follow these steps:
1.Disconnect from the internet.
2.Press Win+R, type cmd to open the command line tool, then in the command line input ‘tasklist | findstr powershell’ to list the PowerShell processes, and ‘taskkill /PID <process_id> /F’ to terminate all PowerShell processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vanshika-panwar @KaboChow and others