unstructured icon indicating copy to clipboard operation
unstructured copied to clipboard

local variable f referenced before assigment

Open AliHaider0343 opened this issue 1 year ago • 2 comments

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.

AliHaider0343 avatar Jul 02 '24 06:07 AliHaider0343

@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.

scanny avatar Jul 02 '24 21:07 scanny

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

Yue-Rain avatar Aug 11 '24 08:08 Yue-Rain

Fixed by #3395

scanny avatar Dec 16 '24 21:12 scanny