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

bug/'isalnum' referenced before assignment #1584

Closed
nikunjgoel95 opened this issue Sep 29, 2023 · 13 comments
Closed

bug/'isalnum' referenced before assignment #1584

nikunjgoel95 opened this issue Sep 29, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@nikunjgoel95
Copy link

Describe the bug
if char.isalnum() != isalnum:
UnboundLocalError: local variable 'isalnum' referenced before assignment

To Reproduce
Provide a code snippet that reproduces the issue.

from langchain.document_loaders import UnstructuredPDFLoader

loader = UnstructuredPDFLoader(file_path, mode = "elements", strategy = "hi_res", pdf_infer_table_structure = True, hi_res_model_name = "chipper")

elements = loader.load()

Expected behavior
Expected for the contents of the PDF to load.

Screenshots
image

Environment Info
Please run python scripts/collect_env.py and paste the output here.
This will help us understand more about the environment in which the bug occurred.

Additional context
Add any other context about the problem here.

@nikunjgoel95 nikunjgoel95 added the bug Something isn't working label Sep 29, 2023
@Klaijan
Copy link
Contributor

Klaijan commented Sep 29, 2023

Hi @nikunjgoel95! if possible, would you mind sharing the document you were working on?

@arash-hajikhani
Copy link

I experienced the same issue and reported it here: langchain-ai/langchain#11247
It worked yesterday with my PDF sets and this has become an issue just in the previous hours.

@Acbet
Copy link

Acbet commented Oct 1, 2023

Yes, I just experienced the same issue. It worked a few days ago, and now it doesn't (no changes' made)

@rondinini
Copy link

Having the exact same issue

@xdurfina
Copy link

xdurfina commented Oct 2, 2023

@Klaijan Hi, it is failing on this pdf. Hope it helps.

@pchalasani
Copy link

here's an error trace -- https://gist.github.com/pchalasani/802c91e897b6433551106ec51942a626

@paluskapter
Copy link

I have the same problem as well.

@awalker4
Copy link
Contributor

awalker4 commented Oct 3, 2023

FYI fix is almost in over here: #1586

@Klaijan
Copy link
Contributor

Klaijan commented Oct 3, 2023

Fix is merging real soon #1586! Thank you all for reporting the issue!

@rondinini
Copy link

@Klaijan Thank you so much for your help!

@Klaijan
Copy link
Contributor

Klaijan commented Oct 3, 2023

It is merged now!

@Klaijan Klaijan closed this as completed Oct 3, 2023
@asharda
Copy link

asharda commented Oct 11, 2023

Upgraded to langchain 0.0.312 but still getting error "An error occurred: cannot access local variable 'isalnum' where it is not associated with a value" when i try to load a pdf using UnstructuredPDFLoader

@awalker4
Copy link
Contributor

Hi @asharda , can you make sure unstructured gets updated as well? pip freeze should show version 0.10.21. I'm not sure if langchain will pull in the latest automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants