Chroma
Chroma copied to clipboard
Python 3 support
Hello,
Chroma doesn't seems to support Python 3.
In [1]: import chroma
File "//anaconda/lib/python3.4/site-packages/chroma/core.py", line 273
except Exception, e:
Kind regards
except Exception, e:
raise ValueError('Invalid Hex Input: %s' % (color_value))
should be changed to
except Exception as e:
raise ValueError('Invalid Hex Input: %s' % (color_value))
but some unit tests are still failling
$ nosetests -s -v
Test alpha support / no-support with various color systems ... ok
Test input that goes beyond color system bounds ... ERROR
Test additive and subtractive mixing ... ok
Test construction of color object ... ERROR
Test equality and inequality ... ok
Test conversion between systems ... ERROR
======================================================================
ERROR: Test input that goes beyond color system bounds
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/scls/github/scls19fr/Chroma/tests/test_chroma.py", line 82, in test_bad_input
self.assertEqual(chroma.Color((300, -3, 50), 'RGB256').rgb256, chroma.Color((255, 0, 50), 'RGB256').rgb256)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 35, in __init__
self.rgb256 = color_value
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 103, in rgb256
self.rgb = map(lambda x: x / 255.0, color_tuple)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 95, in rgb
self.color = tuple(map(self._apply_float_bounds, color_tuple[:3]))
TypeError: 'map' object is not subscriptable
======================================================================
ERROR: Test construction of color object
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/scls/github/scls19fr/Chroma/tests/test_chroma.py", line 38, in test_color_initialization
self.assertEqual(chroma.Color((255, 255, 255), 'RGB256').hex, white)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 35, in __init__
self.rgb256 = color_value
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 103, in rgb256
self.rgb = map(lambda x: x / 255.0, color_tuple)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 95, in rgb
self.color = tuple(map(self._apply_float_bounds, color_tuple[:3]))
TypeError: 'map' object is not subscriptable
======================================================================
ERROR: Test conversion between systems
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/scls/github/scls19fr/Chroma/tests/test_chroma.py", line 64, in test_system_conversion
self.assertTupleAlmostEqual(chroma.Color((51, 85, 119), 'RGB256').rgb, self.c1.rgb)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 35, in __init__
self.rgb256 = color_value
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 103, in rgb256
self.rgb = map(lambda x: x / 255.0, color_tuple)
File "/Users/scls/github/scls19fr/Chroma/chroma/core.py", line 95, in rgb
self.color = tuple(map(self._apply_float_bounds, color_tuple[:3]))
TypeError: 'map' object is not subscriptable
----------------------------------------------------------------------
Ran 6 tests in 0.015s
FAILED (errors=3)
Pinging @aerickson
@rgb256.setter
def rgb256(self, color_tuple):
self.rgb = map(lambda x: x / 255.0, color_tuple)
should be
@rgb256.setter
def rgb256(self, color_tuple):
self.rgb = tuple(map(lambda x: x / 255.0, color_tuple))
Bump :(
@lyneca Until it's merged you can install a pip from a git source. Just use a fork with the code you want.
https://stackoverflow.com/questions/16584552/how-to-state-in-requirements-txt-a-direct-github-source