Unable to parse PDF from directory #172

Open
opened 2026-02-16 00:17:03 -05:00 by yindo · 3 comments
Owner

Originally created by @beratkml on GitHub (Jul 3, 2024).

Everytime I try to run my code it gives an error that the directory doesnt exist:

parser = LlamaParse(api_key=os.getenv("LLAMA_CLOUD_API_KEY"),result_type="markdown")

file_extractor = {".pdf": parser}
reader = SimpleDirectoryReader('./data', file_extractor=file_extractor,recursive=True).load_data()

The error I receive: Error while parsing the file '<bytes/buffer>': file_input must be either a file path string, file bytes, or buffer object

This is my file structure
image

Originally created by @beratkml on GitHub (Jul 3, 2024). Everytime I try to run my code it gives an error that the directory doesnt exist: ``` parser = LlamaParse(api_key=os.getenv("LLAMA_CLOUD_API_KEY"),result_type="markdown") file_extractor = {".pdf": parser} reader = SimpleDirectoryReader('./data', file_extractor=file_extractor,recursive=True).load_data() ``` The error I receive: Error while parsing the file '<bytes/buffer>': file_input must be either a file path string, file bytes, or buffer object This is my file structure ![image](https://github.com/run-llama/llama_parse/assets/122708986/e2452eb9-bdf4-43e1-9c38-cae3cbbbe688)
Author
Owner

@Endairion commented on GitHub (Jul 4, 2024):

Met the same problem as well

@Endairion commented on GitHub (Jul 4, 2024): Met the same problem as well
Author
Owner

@tistu37 commented on GitHub (Jul 6, 2024):

I temporarily solved it by making the changes in the base.py file from the 'fix file_input type issue' pull request.
image

(The change is in line 166)

@tistu37 commented on GitHub (Jul 6, 2024): I temporarily solved it by making the changes in the base.py file from the 'fix file_input type issue' pull request. ![image](https://github.com/run-llama/llama_parse/assets/104708899/12047009-4f6e-42f0-b0e8-80403843d867) (The change is in line 166)
Author
Owner

@mingjun1120 commented on GitHub (Jul 8, 2024):

I temporarily solved it by making the changes in the base.py file from the 'fix file_input type issue' pull request. image

(The change is in line 166)

It works!!! Thanks.

@mingjun1120 commented on GitHub (Jul 8, 2024): > I temporarily solved it by making the changes in the base.py file from the 'fix file_input type issue' pull request. ![image](https://private-user-images.githubusercontent.com/104708899/346283729-12047009-4f6e-42f0-b0e8-80403843d867.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA0NjAwMTAsIm5iZiI6MTcyMDQ1OTcxMCwicGF0aCI6Ii8xMDQ3MDg4OTkvMzQ2MjgzNzI5LTEyMDQ3MDA5LTRmNmUtNDJmMC1iMGU4LTgwNDAzODQzZDg2Ny5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwOFQxNzI4MzBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04OWMxNDg3ZDYzZWE2YzE1YjM2OGI2NWFkOGFkNDU0M2ViMTQ3ZTQxMTI3ZmI2M2E0NjE3YjM3MGZlYTMzN2VlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Y8K8fLQ59NiAFtFn87eb09swbPtRpDAnNAwMqr0sPzU) > > (The change is in line 166) It works!!! Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#172