Closed mandree closed 2 years ago
This is so weird actually. How the hell those tests pass under Linux then? Clearly the conversion breaks somewhere for the FreeBSD setup.
PS: I will have to create dev env for myself, so this might take some time.
@mandree can you let me know what the string value of confidence_values[-1]
is, for the failing test?
I suspect that it is some negative or bogus value.
PS2: This should be resolved now if the value was just a negative number.
The patch in 06e7f80 is insufficient.
confidence_values is [-1, -1, -1, -1, '92.865524']
and that explains it; speaking for Python 3.8 and tesseract 5.0.1:
You cannot construct an int from this '92.865524' string because it does not represent an integer.
You can however construct a float and then round() or int() it, the latter truncates.
So I am trying this, in the try: block, I have changed val = int(...) to val=int(float(...)) - and then it succeeds on Python 3.7...3.9. I cannot currently test 3.10, this needs more work on FreeBSD since it sees distutils stuff and barfs.
...
for i, head in enumerate(header):
result[head] = list()
for row in rows:
if len(row) <= i:
continue
if i != str_col_idx:
try:
val = int(float(row[i]))
except ValueError:
val = row[i]
else:
val = row[i]
result[head].append(val)
return result
I cannot currently test 3.10, this needs more work on FreeBSD since it sees distutils stuff and barfs.
distutils is axed already in the latest release.
For the float
addition -- I will add this as well, because it doesn't harm the existing behavior, but it might need a change in the future.
I cannot currently test 3.10, this needs more work on FreeBSD since it sees distutils stuff and barfs.
distutils is axed already in the latest release.
Yup, I'd seen that but not investigated in more detail since that might have looked like infrastructure work, and also for successful tests on Python 3.10 I think we should also have Pandas/NumPy, which hinges on FreeBSD not providing NumPy 1.22 yet (the first version to formally support Python 3.10).
For the
float
addition -- I will add this as well, because it doesn't harm the existing behavior, but it might need a change in the future.
Thanks.
Hello namesake,
the self-test suite fails on FreeBSD for pytesseract 0.3.8 and 0.3.9 with various Python 3.x versions,
Full story: