Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?

It’s because your enum is not the standard library enum module. You probably have the package enum34 installed. One way check if this is the case is to inspect the property enum.__file__ import enum print(enum.__file__) # standard library location should be something like # /usr/local/lib/python3.6/enum.py Since python 3.6 the enum34 library is no longer compatible … Read more

__getattr__ on a module

There are two basic problems you are running into here: __xxx__ methods are only looked up on the class TypeError: can’t set attributes of built-in/extension type ‘module’ (1) means any solution would have to also keep track of which module was being examined, otherwise every module would then have the instance-substitution behavior; and (2) means … Read more