patch when except ImportError or AttributeError