votes up 1

module (!r) has no attribute (!r)

Package:
numpy
github stars 17141
Exception Class:
AttributeError

Raise code

f attr == "test":
            from numpy._pytesttester import PytestTester
            test = PytestTester(__name__)
            return test

        else:
            raise AttributeError("module {!r} has no attribute "
                                 "{!r}".format(__name__, attr))

    def __dir__():
        return list(globals().keys() | {"f2py_testing", "test"})

else:
    from . import f2py_testing

    from nu

Ways to fix

votes up 0 votes down
# It is not possible to call a non-existing attribut of a module.
# Reproducing the error:

import numpy as np

print(np.true_)   # true_ is not an existing attribute of numpy

#Fix:

print(np.True_)  # True_ is an existing attribute of nympy

Jun 17, 2021 victor_rabiet answer
victor_rabiet 3

Add a possible fix

Please authorize to post fix