0

I am trying to unRAR a folder and then move the files in the RAR file to different folders.

I am running in to an issue when trying to unRar the Files. Here is what I am currently looking at.

import patoolib, os
file = 'C:\\mydocuments\RCExport.rar'
file_path = 'C:\\Users\my_folder'
patoolib.extract_archive(file, outdir= file_path)

When I run the 4th line - I get the error:

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

Which I dont understand because there is clearly a rar file in my file path.

Any help is appreciated.

Pat Doyle
  • 384
  • 2
  • 5
  • 16
  • can you clarify a bit, what is the absolute path of your `rar` file? – Woohoojin Aug 06 '18 at 15:39
  • file = 'C:\\mydocuments\\RCExport.rar' – Pat Doyle Aug 06 '18 at 15:41
  • It's not complaining that it can't find your data file, it's complaining that it can't find a program that can extract it. You'll need to install one. – glibdud Aug 06 '18 at 15:44
  • Thanks @glibdud any recommendations? – Pat Doyle Aug 06 '18 at 15:45
  • Not really, I don't deal with RAR files. But the error says "candidates are (rar,unrar,7z)", so something that provides one of those. – glibdud Aug 06 '18 at 15:46
  • https://github.com/wummel/patool says: _It relies on helper applications to handle those archive formats_. So, you will need to install a helper application to handle rar. The output given above already suggests suitable candidates. See also this answer: https://stackoverflow.com/a/26178369/ – Adrian W Aug 06 '18 at 15:50
  • @PatDoyle 7zip is a good free option to extract rar files. (7z) – Woohoojin Aug 06 '18 at 15:53
  • Possible duplicate of [How can unrar a file with python](https://stackoverflow.com/questions/17614467/how-can-unrar-a-file-with-python) – Adrian W Aug 06 '18 at 15:56
  • It is wierd - I just realized that I have 7zip on my machine - which is weird that patool is not finding it. @ChristianScillitoe – Pat Doyle Aug 06 '18 at 15:56

0 Answers0