I have a module named ColorPalette
with the following enumeration in it:
from enum import Enum
class Color(Enum):
Black = '#000000'
White = '#ffffff'
Purple = '#7e1e9c'
Green = '#15b01a'
Blue = '#0343df'
Pink = '#ff81c0'
Brown = '#653700'
Red = '#e50000'
In this same module, I can do:
if __name__ == '__main__':
print (Color.Yellow.value)
And it prints out the hex value of the color I have defined. However, now in another module, when I import this enum and want to define a variable:
from ColorPalette import Color
black = Color.Black.value
Then the code works (I use the color in a PIL drawing), but Eclipse shows a red underline under the property value
, with the error Undefined variable from import: value
.
Do I miss an import, or does PyDev have this wrong? How could I fix this?
Humm, it seems Enum's are a bit too dynamic to the PyDev type inference engine... Please create a feature request so that I can take a look at this to improve it for this situation (at https://www.brainwy.com/tracker/PyDev/).