I have a problem in unpacking .rar files in Python. I am using macOS, with Anaconda Navigator and Spyder IDE.
I have already installed unrar
, pyunpack
, py7zr
, rarfile
, patool
packages. However, when I run this code:
import zipfile
import numpy as np
import pandas as pd
from rarfile import RarFile
import patoolib
from pyunpack import Archive
# Archive('aaa.rar').extractall(".")
patoolib.extract_archive('aaa.rar')
I get the error message:
PatoolError: could not find an executable program to extract format rar; candidates are (rar,unrar,7z),
and
File "/opt/anaconda3/lib/python3.7/site-packages/patoolib/__init__.py", line 684, in extract_archive
return _extract_archive(archive, verbosity=verbosity, interactive=interactive, outdir=outdir, program=program)
File "/opt/anaconda3/lib/python3.7/site-packages/patoolib/__init__.py", line 470, in _extract_archive
program = find_archive_program(format, 'extract', program=program)
File "/opt/anaconda3/lib/python3.7/site-packages/patoolib/__init__.py", line 336, in find_archive_program
raise util.PatoolError("could not find an executable program to %s format %s; candidates are (%s)," % (command, format, ",".join(programs)))
Can somebody help me, please?
You can use rarfile module