Unstructured-IO / unstructured

Open source libraries and APIs to build custom preprocessing pipelines for labeling, training, or production machine learning pipelines.
https://www.unstructured.io/
Apache License 2.0
8.48k stars 693 forks source link

local variable f referenced before assigment #3337

Open AliHaider0343 opened 2 months ago

AliHaider0343 commented 2 months ago
elements = partition_pdf(pdf_path, strategy="hi_res", languages=["eng"])

the above line is giving error: local variable f referenced before assignment i had checked each and everything its not sorted can someone please refer it and share their opinion.

scanny commented 2 months ago

@AliHaider0343 we'll need the full stack trace to make any sense of this, please post :)

Also, make sure you're using the latest version.

Yue-Rain commented 1 month ago

meet same error. Stack information display the block @contextmanager def save(image): try: with NamedTemporaryFile(prefix='tess_', delete=False) as f: if isinstance(image, str): yield f.name, realpath(normpath(normcase(image))) return image, extension = prepare(image) input_file_name = f'{f.name}_input{extsep}{extension}' image.save(input_file_name, format=image.format) yield f.name, input_file_name finally: cleanup(f.name) path is unstructured_pytesseract.pytesseract.save