语法错误安装django-badgify

时间:2015-08-29 16:17:45

标签: python django django-apps

当我尝试安装django-badgify时,我收到此错误:

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

我正在使用Django 1.8和Python 3.4。这是我可以解决的问题吗? (如果是,它是什么!?)或django-badgify应用程序中的错误?

1 个答案:

答案 0 :(得分:3)

该项目版本使用的是Python 2特定语法,不能与Python 3一起使用。尽管项目是hopeful claims of compatibility

修复它在Python 3上工作可能需要更多的努力,而不仅仅是修复语法错误。这是维护者必须承担的事情。

幸运的是你recent changes确实解决了这些问题,但目前的0.1.5还没有包含这些修正。您必须查看GitHub主分支才能获得这些分支:

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

我不知道该项目是否成功解决了所有Python 3问题。您的里程可能会有所不同。