pythonpython-3.xcolormath

ImportError: cannot import name 'RGBColor'


I am trying to import this:

from colormath.color_objects import RGBColor

and I am getting this error:

ImportError: cannot import name 'RGBColor'

I am using Python 3.6 and the library colormath is installed.


Solution

  • RGBColor is a removed class from an old version of colormath.

    From the v2.0.1 release notes (2014):

    Completely re-worked RGB handling. Each RGB space now has its own class, inheriting from BaseRGBColor. Consequently, RGBColor is no more. In most cases, you can substitute RGBColor with sRGBColor during your upgrade.

    And if you check the current documentation, you'll see there is indeed no RGBColor. Try sRGBColor instead.