I am using Pycharm as my IDE (Python 3.7) and am trying to extract a password protected .rar file (I know the password) and have imported rarfile from unrar but am getting this error "LookupError: Couldn't find path to unrar library."
I also attempted changing my import statement to just say "import rarfile" but instead got the following error "rarfile.RarCannotExec: Unrar not installed?"
I also tried including this line of code, based on something I found in the rarfile documentation: rarfile.UNRAR_TOOL = "unrar" however I got the same errors.
Here is a snippet of my code:
from unrar import rarfile
def hacker(file_path):
passwords = open('pwds.txt', 'r')
with rarfile.RarFile(file_path) as file:
for line in passwords:
try:
file.pwd = line
file.extractall()
except RuntimeError:
pass