faker: AttributeError: 'module' object has no attribute 'Provider' on Faker()

When i create a Faker class i got following error:

ERROR: Failure: AttributeError ('module' object has no attribute 'Provider')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/rentapplication/django-rentapplication/rentapplication/tests/test_api/test_sessions.py", line 10, in <module>
    from rentapplication.tests.helpers import ReferrerFactory, LandlordFactory
  File "/home/rentapplication/django-rentapplication/rentapplication/tests/helpers.py", line 35, in <module>
    f = Faker()
  File "/usr/local/lib/python2.7/dist-packages/faker/factory.py", line 38, in create
    prov_cls, lang_found = cls._get_provider_class(prov_name, locale)
  File "/usr/local/lib/python2.7/dist-packages/faker/factory.py", line 49, in _get_provider_class
    provider_class = cls._find_provider_class(provider, locale)
  File "/usr/local/lib/python2.7/dist-packages/faker/factory.py", line 87, in _find_provider_class
    return provider_module.Provider
AttributeError: 'module' object has no attribute 'Provider'```

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22

Commits related to this issue

Most upvoted comments

+1

@aramanath The latest commit on python-testdata is from 2014. That makes me think it was written against an ancient version of Faker, probably v0.4.2 or earlier. You should file an issue on python-testdata.

Having same problem with Faker-0.8.10

Installed via pip in a python 3.6.3 virtual env

I’m getting this trying to run it on AWS lambda as well.