How To Extract Password Protected Rar File Using Patool On Google Colab

Question:

I have installed patool on Google Colab. The patool command works file with:

patoolib.extract_archive("/content/drive/My Drive/File_name.part1.rar", outdir="/content/drive/My Drive/Folder/")`

After it’s sucessfully finished, it has extracted 10 part zip files.

But when I am trying to extract those 10 files, it returns errors, and is asking for a password. I do know the password and whenever I give the password, it says “program aborted”.

Asked By: Srijon Sarker

||

Answers:

For 7z, you can use

! 7z e -pPASSWORD "path/to/file.zip"

to extract a file with password.

Answered By: korakot

patool can handle password protected archives. You only need to add verbosity=1 as shown:

import patoolib
patoolib.extract_archive(r'your file path', outdir=r"folder path", verbosity=1)

now, cmd opened in new window like this and asked you to enter the password:

enter image description here

if you have other files in it, it asked you again. you can press ‘A’ to apply this to all files in it like this:

enter image description here

I hope this help you.

Answered By: Pedram Porbaha