0

When I try to install django-badgify, I am getting this error:

Traceback (most recent call last):
  File "./manage.py", line 10, in
    execute_from_command_line(sys.argv)
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/django/core/management/init.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/django/core/management/init.py", line 312, in execute
    django.setup()
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/django/init.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/importlib/init.py", line 109, in import_module
    return bootstrap.gcd_import(name[level:], package, level)
  File "", line 2231, in _gcd_import
  File "", line 2214, in _find_and_load
  File "", line 2203, in _find_and_load_unlocked
  File "", line 1200, in _load_unlocked
  File "", line 1129, in _exec
  File "", line 1448, in exec_module
  File "", line 321, in _call_with_frames_removed
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/badgify/models/__init.py", line 5, in
    from ..utils import load_class
  File "/home/myusername/Developer/hackerspace_online/lib/python3.4/site-packages/badgify/utils.py", line 56
    except ImportError, e:
                      ^
SyntaxError: invalid syntax

I am using Django 1.8 and Python 3.4. Is this a problem I can fix? (If so, what is it!?) or a bug in the django-badgify app?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
43Tesseracts
  • 4,617
  • 8
  • 48
  • 94

1 Answers1

3

That version of the project is using Python 2 specific syntax, and cannot be used with Python 3. This in spite of the project's hopeful claims of compatibility.

Fixing it to work on Python 3 is probably going to require more effort than just fixing that syntax error. This is something the maintainers will have to undertake.

Lucky for you recent changes did address those, but the current 0.1.5 does not yet include those fixes. You'll have to check out the GitHub master branch to get those:

pip install git+https://github.com/ulule/django-badgify.git

I do not know if the project managed to address all Python 3 issues. Your mileage may vary.

Alasdair
  • 298,606
  • 55
  • 578
  • 516
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Ok, but if I'm reading the page right, they THINK it is python 3.4 compatible right? at the bottom of the page it lists compatibilities: https://github.com/ulule/django-badgify – 43Tesseracts Aug 29 '15 at 16:20
  • @43Tesseracts: ah, they do claim compatibility. But the code you installed is *not* compatible. I'll take a look. – Martijn Pieters Aug 29 '15 at 16:22
  • @43Tesseracts: the code on GitHub has moved on from the version you are using, at the very least. – Martijn Pieters Aug 29 '15 at 16:23
  • 1
    @43Tesseracts: the 0.1.5 release on PyPI does not include the fixes; the project has yet to create a release with the fixes included. – Martijn Pieters Aug 29 '15 at 16:25