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

ZeroDivisionError #398

@Fedorov688

Description

@Fedorov688

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions