Skip to content

zipfile.BadZipFile: File is not a zip file #60

@sqlmiles

Description

@sqlmiles

Cześć,

workflow exportu kończy się błędem jeśli filtr w InvoiceExportRequest nie zwróci żadnej faktury

File "/home/someuser/code/ksef_test/ksef.py", line 59, in get_invoices
    result = export.download_and_process_package(package, encryption)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/someuser/code/ksef_test/build/site-packages/ksef_client/services/workflows.py", line 982, in download_and_process_package
    unzipped = unzip_bytes_safe(archive_bytes)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/someuser/code/ksef_test/build/site-packages/ksef_client/utils/zip_utils.py", line 82, in unzip_bytes_safe
    with zipfile.ZipFile(io.BytesIO(data), "r") as zf:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/someuser/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/zipfile/__init__.py", line 1354, in __init__
    self._RealGetContents()
  File "/home/someuser/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/zipfile/__init__.py", line 1421, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

P.S. świetna paczka, dzięki za udostępnienie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions