Not managing to extract RAR archive using rarfile module
<p>I have been trying to make a script that extracts *.rar files for but am receiving errors. I've been struggling to understand the documentation of the module to no avail (I'm new to programming so sometimes get a bit lost in all the docs).</p>

<p>Here is the relevant part of my code, and the error received.</p>

<p>Snippet from my code:</p>

<pre><code>import rarfile
rarpath='/home/maze/Desktop/test.rar'

def unrar(file):
    rf=rarfile.RarFile(file)
    rf.rarfile.extract_all()

unrar(rarpath)
</code></pre>

<p>Error received:</p>

<pre><code>  File "unrarer.py", line 26, in unrar
    rf.rarfile.extract_all()
AttributeError: 'str' object has no attribute 'extract_all'
</code></pre>

<p>I have installed <code>rarfile</code>2.8 and <code>unrar</code>0.3 using <code>pip</code> (note sure if the later was necessary).</p>

<p>Thanks in advance for any assistance correcting my function or helping understand the package's documentation.</p>