arteria / cmsplugin-contact-plus

With cmsplugin-contact-plus building custom forms for your django-cms project is a breeze. Now it's so easy to build the forms with exactly the fields you want in the order you want - with a minimal effort.
https://github.com/arteria/cmsplugin-contact-plus
BSD 3-Clause "New" or "Revised" License
30 stars 33 forks source link

__file__ doesn't exist for frozen imports #48

Closed bmon closed 7 years ago

bmon commented 7 years ago

After installing this extension my django server fails to start with the following stacktrace:

Traceback (most recent call last):
  File "./manage.py", line 20, in <module>
    execute_from_command_line(sys.argv)
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/django/core/management/__init__.py", line 327, in execute
    django.setup()
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/django/apps/config.py", line202, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/brendan/.venv/myproj2/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/cmsplugin_contact_plus/models.py", line 23, in <module>
    localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()
  File "/home/brendan/.venv/myproj2/lib/python3.6/site-packages/cmsplugin_contact_plus/utils.py", line 45, in autodiscover_templates
    dir = os.path.dirname(_.__file__)
AttributeError: module 'snowpenguin' has no attribute '__file__'

I did a bit of digging and found this discussion: https://bugs.python.org/issue20942

Is this a bug with contact-plus? The only module I have installed that causes this error is snowpenguin (part of django-recaptcha2).

jvamvas commented 7 years ago

Thank you for reporting this bug. From the next release on, this feature will be deleted