-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
On Python 3, rarfile<3.0 does not support bytes filename #2443
Comments
In most cases we do pass string file names to rarfile, but we must have missed one :( |
Thanks for pointing that out! It looks like we'll need to either (a) hope for a speedy release of the new version of rarfile, or (b) add an adapter to |
@sampsyo shouldn't |
Hmm, you're right that it should… sorry I didn't think of that! But we already pass the archive path through Line 990 in 8ccdb1c
|
I wonder which line |
@jrobeson it is coming from here: Line 1158 in 8ccdb1c
extract method raises an exeption when the is_rarfile method is called with a bytes argument. Maybe we could use py3_path before calling this method ?
Actually, I misrepresented the file name in my example command. Sorry, I will edit the original ! What I ran beets on was : beet -vv import /mnt/E/group\ -\ album.rar |
Here's the thing, though, @Lompik: that |
@sampsyo The exeption is raised at line Line 985 in 8ccdb1c
path_test =is_rarfile . I guess py3_path should be used on self.toppath before calling path_test . I can create a pull request if it's not clear.
|
That would it explain it; thanks! Would you mind opening a PR if it's easy? That will run the CI on the change to make sure it doesn't break the other archiving backends. |
The above is a trivial fix. CI seems green. In fact the same piece of code (albeit with the fix) Line 985 in 8ccdb1c
is_archive initialisation. So I tried to refactor the code to benefit from the same archive detection code. But it's sketchy: https://github.com/Lompik/beets/commit/0cb53a924249cb35531ace5b28ca8af6fb9a6513
|
Lovely; thanks for the one-line fix! ✨ It's merged. And I see what you tried to do with the refactor, but I agree with you—the simpler change seems to end up in a more readable state. |
Problem
Importing rar files does not work anymore. It used to work with beets
1.4.2
and below.The underlying problem is that
is_rarfile
does no accept bytes (andtoppath
variable is byte). See this commit markokr/rarfile@7d7a2cb where future versions (once or twice a year) ofrarfile
will gladly accepts bytes.Running this command in verbose (
-vv
) mode:Led to this problem:
Setup
EDIT: change filename
The text was updated successfully, but these errors were encountered: