Я сделал это так, но на архиве нет пароля
create_password = random.randbytes(20)
for i in range(rand_photo):
file = ['photo/*.jpg']
images = glob.glob(random.choice(file))
random_img = random.choice(images)
# compressing file
with pyzipper.AESZipFile(f'zip/{message.from_user.id}.zip','a') as create_zip_file:
create_zip_file.write(random_img)
create_zip_file.setpassword = create_password