How To Fix Python Enum - AttributeError(name) From None Error?
Trying to use an enum in Python 3.7.3, getting the following error. Already tried to install - and uninstall - enum34, but it still does not work. Did all the operations in a virtu
Solution 1:
The correct syntax for defining an enum is:
class Status(Enum):
on = 1
off = 2
Not on: 1
.
Solution 2:
In your definition, use =
to assign values to the attributes, not :
.
# enum definition:
class Status(Enum):
on = 1
off = 2
Post a Comment for "How To Fix Python Enum - AttributeError(name) From None Error?"