Skip to content

ZeroDivisionError #64

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

Open
alanjds opened this issue Aug 21, 2018 · 1 comment
Open

ZeroDivisionError #64

alanjds opened this issue Aug 21, 2018 · 1 comment
Labels
imported Imported from google/grumpy waiting feedback Waiting confirmation of changes or fixes

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#398 opened by @Fedorov688 on Feb 27

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)

https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/colorsys.py#L81

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
@alanjds
Copy link
Author

alanjds commented Sep 2, 2018

@Fedorov688 Thanks for reporting, but this is a bit hard to understand. Do this work on CPython and is broken on Grumpy?

I will close for now until more feedback is provided. Please reopen if you can confirm that it works on CPython and fails on Grumpy.

@alanjds alanjds added the waiting feedback Waiting confirmation of changes or fixes label Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Imported from google/grumpy waiting feedback Waiting confirmation of changes or fixes
Projects
None yet
Development

No branches or pull requests

1 participant