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

Failure to rip CD: "ValueError: could not convert string to float: " #374

Closed
Freso opened this issue Feb 22, 2019 · 16 comments
Closed

Failure to rip CD: "ValueError: could not convert string to float: " #374

Freso opened this issue Feb 22, 2019 · 16 comments
Labels
Accepted Accepted issue on our roadmap Bug Generic bug: can be used together with more specific labels Priority: critical Critical priority Regression Bug that breaks functionality known to work in previous releases
Milestone

Comments

@Freso
Copy link
Member

Freso commented Feb 22, 2019

Trying to rip Hamza El Din - Escalay (The Water Wheel): Oud Music, I get this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/whipper/extern/task/task.py", line 521, in c
    callable_task(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 131, in _read
    float(self._parser.tracks))
ValueError: could not convert string to float: 
CRITICAL:whipper.command.main:exception ValueError at /usr/lib/python2.7/site-packages/whipper/program/cdrdao.py:131: _read(): could not convert string to float: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/whipper/extern/task/task.py", line 521, in c
    callable_task(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/whipper/program/cdrdao.py", line 131, in _read
    float(self._parser.tracks))
ValueError: could not convert string to float: 

It's apparently trying to convert an empty string to a float. I didn't figure out why it was getting an empty string at a quick glance.

CD TOC from cdrdao read-toc --device '/dev/sr0' ~/tmp/23016bff-10d1-404c-aa90-f50d36c83390.toc: 23016bff-10d1-404c-aa90-f50d36c83390.toc.gz
whipper debug log output (with a couple of extra logger.debug statements thrown in to try and figure out what was going on, so line numbers may not line up perfectly…): whipper.log.gz

@Freso Freso added this to the 1.0 milestone Feb 22, 2019
@Freso Freso added Bug Generic bug: can be used together with more specific labels Priority: critical Critical priority labels Feb 22, 2019
@Freso Freso modified the milestones: 1.0, 0.8.0 Feb 23, 2019
@Freso Freso added the Regression Bug that breaks functionality known to work in previous releases label Mar 17, 2019
@Freso
Copy link
Member Author

Freso commented Mar 17, 2019

This was introduced by #345

@Freso
Copy link
Member Author

Freso commented Mar 17, 2019

What I've found is that it includes some blank lines that it's trying to parse, which is the direct cause for the error (ie., the result of calling float("")). Debugging it today, it also seems like self._parser.tracks never changes from 0, which might be a symptom of the underlying issue.

I tried a if not line: continue in cdrdao.ReadTOCTask._read(), but that didn't seem to fix it either, so the parsing of blank lines does not seem to be the core of the issue, I think?

I tried to set up a test case, mocking around some of the data functions, but there are too many moving parts that are based on state and inheritance, so I can't really figure out a good angle for making a test for this. Ideally, I'd be able to just call cdrdao.ReadTOCTask._read() and feed it the .toc file and then it should fail (with the current code). (This is something that absolutely should have test accompanying its fix to ensure it doesn't regress again.)

Maybe @jtl999 can help here, having written the code?

@Freso Freso removed their assignment Mar 17, 2019
@JoeLametta
Copy link
Collaborator

Maybe @jtl999 can help here, having written the code?

@jtl999 If that's the case feel free to self assign this issue.

@JoeLametta JoeLametta added the Accepted Accepted issue on our roadmap label Mar 18, 2019
@srussel
Copy link

srussel commented Mar 23, 2019

I ran into the same problem. I fixed it by changing _LAST_TRACK_RE in cdrdao.py to

_LAST_TRACK_RE = re.compile(r"^\s*(?P<track>[0-9]+)")

It seems there is a space before the track number in the cdrdao output. I also assume the [0-9]* should be [0-9]+ otherwise float() could also fail with 0 digits matched.

@jtl999
Copy link
Contributor

jtl999 commented Mar 23, 2019

I'm currently busy but I'll see if I can give this a test in a few days.

@Freso
Copy link
Member Author

Freso commented Mar 23, 2019

@srussel Thanks!

I'd also really like if this doesn't make it in without a test to make sure it doesn't regress again in the future.

@JoeLametta
Copy link
Collaborator

@jtl999 Ping. 😉

/remind jtl999 to please review this issue in 3 days

@reminders reminders bot added the Reminder User requested reminder: automatically tagged by the reminders bot label Apr 2, 2019
@reminders
Copy link

reminders bot commented Apr 2, 2019

@JoeLametta set a reminder for Apr 5th 2019

@JoeLametta JoeLametta pinned this issue Apr 2, 2019
@reminders reminders bot removed the Reminder User requested reminder: automatically tagged by the reminders bot label Apr 5, 2019
@reminders
Copy link

reminders bot commented Apr 5, 2019

👋 @jtl999, please review this issue

@JoeLametta
Copy link
Collaborator

@jtl999 Ping. 😉

@Freso
Copy link
Member Author

Freso commented Jul 12, 2019

I can borrow the CD again and try with and without the regex, but I’d really like if someone can think up a way to test this so we can prevent it from regressing in the future.

@Freso
Copy link
Member Author

Freso commented Jul 20, 2019

I tried this with Salif Keita’s ‘“Folon”… The Past’ (Disc ID) which gave the same error, and @srussel’s regex from #374 (comment) change fixes the issue for me.

I would still very much like if this could be tested to prevent future regressions, but if no one can come up with a way to do this, I’d say we should just get the fix in so we can move closer to a 0.8.0 release.

@ConcernedOne
Copy link

ConcernedOne commented Jul 22, 2019

Howdy.
Disc Thundra - Ignored by Fear (https://musicbrainz.org/release/e76e5936-328d-457f-9522-e9d0ccf25186), same error.
Successfully fixed with solution in comment #374.
The disc is in my possession indefinitely, please reach me out if you like to test something else.

whipper 0.7.4.dev76+g57d386e

@jtl999
Copy link
Contributor

jtl999 commented Jul 22, 2019

I have emerged from my absence

I haven't touched anything whipper related since last December but while I was testing #345 I don't recall experiencing the issue in question with any of my discs.

I just checked and the environment I was using to test was an Ubuntu 18.04 LXC container with sr0 block device passthrough, whipper from git (a bit vague because I've used both "my personal fork" and upstream in the past) and cdrdao v1.2.3 from Ubuntu 18.04's universe repository.

At some point I'll see if I can rip a bunch of discs with a recent whipper build and reproduce this issue.

@JoeLametta
Copy link
Collaborator

I would still very much like if this could be tested to prevent future regressions, but if no one can come up with a way to do this, I’d say we should just get the fix in so we can move closer to a 0.8.0 release.

👍

@JoeLametta JoeLametta added the Status: in progress Issue/pull request which is currently being worked on label Aug 8, 2019
@JoeLametta
Copy link
Collaborator

Fixed thanks to #418.

@JoeLametta JoeLametta unpinned this issue Oct 23, 2019
@JoeLametta JoeLametta removed Needed: patch A pull request is required Needed: tests Tests are required Status: in progress Issue/pull request which is currently being worked on labels Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug Generic bug: can be used together with more specific labels Priority: critical Critical priority Regression Bug that breaks functionality known to work in previous releases
Projects
None yet
Development

No branches or pull requests

5 participants