简体   繁体   中英

How to unzip .rar file with Python and patoolib

I need uncompress .rar file in Google Colab with Python3. First I tried to do localy in MacOS.

I have installed Patoolib package:

pip install patool

and unrar to unzip .rar files

brew install unrar

Then, In my python script I do:

import patoolib
patoolib.extract_archive("data_2/Peliculas.rar", outdir="/data_2")

and I get the following error :

PatoolError: could not find an executable program to extract format rar; candidates are (rar,unrar,7z),

I need to configure Patool to use unrar but there is no documentation available. Somebody knows how to solve this error?

My issue was solved by simply adding my Winrar directory to my Path (in system environment variables). Made the horrible mistake of assuming it was set up by default (because why wouldn't it, it's already on the contextual menus right?), but that was not the case.

Hope this helps whoever reads this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM