Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinRAR 5.x RAR format support #13

Closed
almightiest opened this issue Apr 21, 2015 · 12 comments
Closed

WinRAR 5.x RAR format support #13

almightiest opened this issue Apr 21, 2015 · 12 comments

Comments

@almightiest
Copy link

Currently an error/stacktrace is thrown on version 5 RAR format (RAR5). The spec is located at http://www.rarlab.com/technote.htm

Are there any plans to support this?

@markokr
Copy link
Owner

markokr commented Apr 22, 2015

It would be nice to support it, but it's not a high priority for me.

@thezoggy
Copy link

note we added rar5 support to the original version.... prob could easily just grab the modifications and apply them pretty easily:
https://github.com/sabnzbd/sabnzbd/blob/develop/sabnzbd/utils/rarfile.py

@markokr
Copy link
Owner

markokr commented Sep 28, 2015

There is just signature support in is_rarfile(). Which is not enough to actually process the files.

I could add just that to rarfile.py too, but it feels wrong that is_rarfile returns true, but rest of the processing fails.

@markokr
Copy link
Owner

markokr commented Jun 11, 2016

Btw, RAR5 support is in GIT now, please play around with it, does it work for you?

@almightiest
Copy link
Author

Thanks! I'll play with it in a couple weeks. Just moved so too much going
on at the moment.

On Sat, Jun 11, 2016, 8:24 AM Marko Kreen notifications@github.com wrote:

Btw, RAR5 support is in GIT now, please play around with it, does it work
for you?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#13 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABWFswTFcypU5l-IzmYyhKUvQiAfxMN9ks5qKqkEgaJpZM4EFdyL
.

@XenHat
Copy link

XenHat commented Dec 2, 2016

I cannot seem to be able to extract a rar5 archive.
I'm currently using Windows 10
My error is:

  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 2800, in custom_popen
    raise RarCannotExec("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarCannotExec: Unrar not installed? (rarfile.UNRAR_TOOL='unrar')

What I have done so far:

  • WinRAR is in my path, and I even added Unrar.dll and Unrar.lib to path as well.
  • cloned master, ran setup.py build && setup.py install.
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 811, in extractall
    self._extract(fnlist, path, pwd)
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 877, in _extract
    p = custom_popen(cmd)
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 2805, in custom_popen
    raise RarCannotExec("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarCannotExec: Unrar not installed? (rarfile.UNRAR_TOOL='unrar')
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 811, in extractall
    self._extract(fnlist, path, pwd)
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 877, in _extract
    p = custom_popen(cmd)
  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 2800, in custom_popen
    raise RarCannotExec("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarCannotExec: Unrar not installed? (rarfile.UNRAR_TOOL='unrar')
  • attempted to use unrar pip module (v2.8), which logically fails to recognize my rar5 as a valid archive.
  • reinstalled master, tried to set rarfile.UNRAR_TOOL to full path to Winrar executable, Same error.
  • set rarfile.UNRAR_TOOL to full path of Unrar.dll, got Not valid win32 application. Same with Unrar.lib

I'm out of ideas.

Did I miss a step?

@markokr
Copy link
Owner

markokr commented Dec 3, 2016

Make sure directory of unrar.exe is in PATH. Or move unrar.exe to directory in already in PATH. Or put full path to unrar.exe to UNRAR_TOOL.

@XenHat
Copy link

XenHat commented Dec 3, 2016

As specified in my previous comment, unrar.exe is in path already, under UnRar.exe due to the way it comes bundled with the official WinRar distribution. Setting full path to unrar to UNRAR_TOOL already failed.
I shall perform more tests with case-sensitivity in mind, assuming there's a bug somewhere, and try to move it in SYSTEM path (Currently resides in user path).

EDIT:
Still unable to make this work.

  File "C:\Python27\lib\site-packages\rarfile-3.0-py2.7.egg\rarfile.py", line 2805, in custom_popen
    raise RarCannotExec("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarCannotExec: Unrar not installed? (rarfile.UNRAR_TOOL='C:\\Program Files\\WinRAR\\UnRAR.exe')

>which unrar
/cygdrive/c/Program Files/WinRAR/unrar

I have also tried several other locations which do not require special permissions to access, without success.

I would like to remind that rarfile 2.8 can find my unrar binary without problems

@XenHat
Copy link

XenHat commented Dec 4, 2016

I'm not sure of the relevancy of this information, but there appears to be a stability issue with python 2.7.x and pOpen from sys on Windows 10. My knowledge of python is fairly limited but this might be worth investigating.

If this information is not relevant, I would appreciate some help on how to get rarfile working. I followed the documentation steps and I have a working zipfile implementation to base myself on.

As a heavy RAR user, I have quite a few use cases I can test rarfile against and am willing to provide feedback on the RAR5 implementation. However, I am failing to get the python bits working. 😞

The next step on my end is to use my Linux-based laptop environment to test rarfile.

@XenHat
Copy link

XenHat commented Dec 5, 2016

After further testing, it would appear that rarfile does find the binary but seem to "fall back" to returning "rar not found" (RarCannotExec) due to malformed/incorrect methods to retrieve info from the file.
The example I was using was written for zipfile and there seem to be a few crucial differences I need to work around and handle with rarfile
Using new code I wrote today, I was able to get the file list and to read a file within the archive. 👍
I am currently re-writing the logic in my program. I will report back if I have more info to provide.

@XenHat
Copy link

XenHat commented Dec 5, 2016

I have created #29

@markokr
Copy link
Owner

markokr commented Dec 27, 2016

rarfile v3.0 with rar5 support is now on pypi

@markokr markokr closed this as completed Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants