Open haywhisksoftware opened 10 years ago
This is the reason for the error.
return float(len(text)) / len(fdata) - (1e-6 * fragment.start)
If the float that is being returned is inversely proportional to length of fdata, can we just write this.?
fdata = page.fragment_data(fragment).strip()
if text in fdata:
if not len(fdata):
return float("inf")
return float(len(text)) / len(fdata) - (1e-6 * fragment.start)
else:
return 0.0
return func
This isn't a wacky edge-case at all.
I got the same error using actual data and had to patch it.
Same here, I reproduced this error using regular, non-empty data.
the patch has been merged, I believe this issue can be closed?
(Minor bug.) I installed scrapely from pip this morning.
This is a wacky edge case, but I think you could raise a more constructive error.
(Who wants to extract a zero-length string from a document? It's a bit like a magician pulling some atmosphere out of a hat: it's always going to be there...)
Check it out: