Open
Description
I'm using the following code.
outdbfp
is a pathlib.WindowsPath
of the file I want to compress. Its value is of the form MYPATH\db.sqlite3
.
outdbzip
is a pathlib.WindowsPath
of the output file I want. Its value is of the form MYPATH\db.7z
.
Notice the two files are on the same directory.
shutil.register_archive_format('7zip', py7zr.pack_7zarchive, description='7zip archive')
shutil.make_archive (
outdbzip.stem,
'7zip',
root_dir=outdbzip.parent,
base_dir=outdbfp.name,
logger=logging.getLogger(),
dry_run=True
)
However there are 2 problems:
- py7zr doesn't seem to cd into
root_dir
. I have to providebase_dir=outdbfp
otherwise it will way that the file does not exist. dry_run=True
seems to be ignored, as py7zr starts right away