I'm trying to find a way to write a df to zip file and add a password to it but I can't figure out how.
I've tried
import zipfile
archive_name='test.zip'
zf = zipfile.ZipFile(archive_name, 'w')
zf.setpassword(b"1234")
But it always says the file is in use by another process. And when I check other posts it says this is not the preferred method zipfile: how to set a password for a Zipfile?.
I'd like to only use a native library but it seems like there is no native way to do this Create password protected zip file Python. Can that really be true?