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

Extraneous "b" in error messages #5181

Open
MarkTerMors opened this issue Apr 6, 2024 · 2 comments
Open

Extraneous "b" in error messages #5181

MarkTerMors opened this issue Apr 6, 2024 · 2 comments

Comments

@MarkTerMors
Copy link

MarkTerMors commented Apr 6, 2024

When beets presents an error message there is sometimes an extraneous letter "b" at the start of the path in the message.

Problem

This album is already in the library!
V
could not get filesize: [Errno 2] No such file or directory: b'/media/music/P/Peter Tosh/Equal Rights/01 Get Up, Stand Up.1.mp3'

Led to this problem:

(paste here)

beets version 1.6.1
Python version 3.11.2

Setup

  • OS: Debian 12
  • Python version: 3.11.2
  • beets version: 1.6.1
@arsaboo
Copy link
Contributor

arsaboo commented Apr 6, 2024

This is likely not an issue with the path itself but how the error message is formatted or how the path is being handled internally by beets. It is probably related to how Python represents byte strings. The "b" prefix indicates that the string is in bytes rather than a standard string (which is in Unicode).

@wisp3rwind
Copy link
Member

Looks like this is coming from

log.warning("could not get filesize: {0}", exc)

If we want to pretty-print this, I guess we should be catching the various subclasses of OSError explicity and apply displayable_path when logging them (i.e. manually format the message instead of interpolating "{exc}"). Not sure whether that is worth the effort.

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

3 participants