Uploading and uncompressing zipfile using pybis

Hi all,

I am trying to upload a zip file as dataset using pybis==1.37.4 (Testen on OpenBis versions 20.10.11.1 and 20.10.12.5).

In general the file upload is working, however I am trying to set the option to uncompress the file in openbis so that all individual files of the zip archive show in the dataset (instead of just archive.zip)

Here is my example code (assuming openbis connection o and entring some permID for the file to attach the dataset):

# Source - https://stackoverflow.com/a/44946732
# Posted by Vladimir, modified by community. See post 'Timeline' for change history
# Retrieved 2026-03-03, License - CC BY-SA 4.0

import io
import zipfile

filename = "./archive.zip"

# create zip archive
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, "a", zipfile.ZIP_DEFLATED, False) as zip_file:
    for file_name, data in [
        ("1.txt", io.BytesIO(b"111")),
        ("2.txt", io.BytesIO(b"222")),
    ]:
        zip_file.writestr(file_name, data.getvalue())

# write to disk
with open(filename, "wb") as f:
    f.write(zip_buffer.getvalue())

# upload to dataset with pybis
object_permid = "" # set some permId for testing here
obj = o.get_object(object_permid)
dataset = o.new_dataset(type="ATTACHMENT", sample=obj, zipfile=filename)
dataset.save()

If I upload the file in the web UI and select the “uncompress before import” option everything works as expected

image

With pybis I end up with this instead:

image

The relevant section in the pybis documentation seems to use the same command syntax

ds_new = o.new_dataset(
    type       = 'RAW_DATA',
    sample     = '/SPACE/SAMP1',
    zipfile    = 'my_zipped_folder.zip',
)
ds_new.save()

Any hints on what I am doing wrong?

thanks in advance,
Cagtay