Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

ZeroDivisionError #398

Open
Fedorov688 opened this issue Feb 27, 2018 · 0 comments
Open

ZeroDivisionError #398

Fedorov688 opened this issue Feb 27, 2018 · 0 comments

Comments

@Fedorov688
Copy link

Hi, if i use this function (colorsys.rgb_to_hls(r, g, b)) and, for example, my data r = 0, g = 1, b = 2 or r = 0, g = 0, b = 2. I get an error.
My crutch in this problem:
if (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and r == 2:
r = 3
print("crutch")
elif (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and g == 2:
g = 3
print("crutch")
elif (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and b == 2:
b = 3
print("crutch")
try:
hls_tmp = colorsys.rgb_to_hls(r, g, b)
except(ZeroDivisionError):
print(r, g, b)
exit(0)

s = (maxc-minc) / (2.0-maxc-minc)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant