Пробую сделать так:
import os, rarfile
xpath= "/dbfs/mnt/databricks/Staging_history/Mindbox_history_BZ/part1/BZ_extract_part/"
dpath= "/dbfs/mnt/databricks/Staging_history/Mindbox_history_BZ/part1/"
def unrar(dpath, xpath):
for rar in os.listdir(dpath):
filepath = os.path.join(dpath, rar)
with rarfile.RarFile(filepath) as opened_rar:
for f in opened_rar.infolist():
print (f.filename, f.file_size)
opened_rar.extractall(xpath)
unrar(dpath, xpath)
Получаю такую ошибку:
RarCannotExec: Cannot find working tool
RarCannotExec Traceback (most recent call last)
<command-2434645994974025> in <module>
13 opened_rar.extractall(xpath)
14
---> 15 unrar(dpath, xpath)
<command-2434645994974025> in unrar(dpath, xpath)
11 for f in opened_rar.infolist():
12 print (f.filename, f.file_size)
---> 13 opened_rar.extractall(xpath)
14
15 unrar(dpath, xpath)
/local_disk0/.ephemeral_nfs/envs/pythonEnv-6b5b37aa-a579-4089-ba56-b5b70f69eb0a/lib/python3.8/site-packages/rarfile.py in extractall(self, path, members, pwd)
845 for m in members:
846 inf = self.getinfo(m)
--> 847 dst = self._extract_one(inf, path, pwd, not inf.is_dir())
848 if inf.is_dir():
849 if dst not in done: