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

confuse should be able to return bytestrings for Filename() #51

Open
ghost opened this issue Jun 20, 2016 · 5 comments
Open

confuse should be able to return bytestrings for Filename() #51

ghost opened this issue Jun 20, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Jun 20, 2016

No description provided.

@sampsyo
Copy link
Member

sampsyo commented Jun 20, 2016

Can you elaborate a little bit? Where exactly is this needed, and why (vs. just wrapping the lookup with bytestring_path())?

@ghost
Copy link
Author

ghost commented Jun 20, 2016

If you do:

config['foo']['file'] =  some_bytestring   # like we do in beet in various places (likely in the tests)

and then attempt

file = config['foo']['file'].as_filename()

then it'll blow up right here https://github.com/beetbox/beets/blob/master/beets/util/confit.py#L1350

@sampsyo
Copy link
Member

sampsyo commented Jun 20, 2016

Got it. In those cases, it's probably best to change the tests—because, in the real world, those values with be Unicode strings when they come from config files. (And we'd like to test conditions that resemble the real world.)

@ghost
Copy link
Author

ghost commented Jun 20, 2016

ok, so that's back to the age old question of converting bytestring filenames to utf-8. come up with a name for the utility function yet? :)

@sampsyo
Copy link
Member

sampsyo commented Jun 20, 2016

Right; good point. Let's call it unicode_path, I suppose. On Python 3, it can use surrogateescape; on Python 2, I suppose it should just use strict errors.

@arcresu arcresu transferred this issue from beetbox/beets Jun 1, 2019
@arcresu arcresu changed the title confit should be able to return bytestrings for Filename() confuse should be able to return bytestrings for Filename() Jun 2, 2019
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

1 participant