Skip to content

bug/error with 'fake' file and assigned name in partition_pdf function #1644

Closed
@Guiforge

Description

@Guiforge

Describe the bug
When we use not real io file with name attribute partition_pdf failed with no such file or directory.
This can happen, for example, when you extract files from a zip file with ZipFile and open

To Reproduce

import io

# Create a 'fake' file
file = io.BytesIO()
file.name = 'tmp.pdf'

# Call the partition_pdf function
result = partition_pdf(file=file)

Expected behavior
Same experience than spooltempfile with no attribute name

Screenshots
...

Environment Info
...

Additional context

  • This issue occurs when using a file object with an assigned name.
  • The bug can be reproduced when extracting a file from a ZIP archive, where the file has a name but does not exist in the filesystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions