'I am facing Error(Cannot find working tool) in rarfile extraction in python

I want to extract a rarfile using python rarfile lib. this is my code

 import rarfile as rar
    def Extractor(extract_to_folder, file, base_file_path):  
        rar_ = rar.RarFile(base_file_path)
        rar_.extract(rar_, extract_to_folder)
        rar_.close()

Extractor('F:\MyFiles\myExFolder', 'howToAccess.txt', 'F:\MyFiles\River.rar')

after executing the script, the following error is raised:

raise RarCannotExec("Cannot find working tool")
rarfile.RarCannotExec: Cannot find working tool



Solution 1:[1]

So most likely you are missing the tool that extracts files out of your RAR file. Assuming you are using Ubuntu, run one of the following commands to solve your issue:

sudo apt install bsdtar

or

sudo apt install unrar

Solution 2:[2]

If you have WinRar installed in your machine. configure the path of winrar in the system environment variable , and then restart your editor.

Hope, problem will be fixed.

image

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nads
Solution 2 Toufique Hasan