woefipuasd
woefipuasd

Reputation: 23

Converting Django project from Python 2 to Python 3: pip3 install django_comments NameError unicode

System info: 64-bit OS-X, Python 3.7

I am converting a Django website from Python 2 to Python 3. To do this, I ran 2to3 on the whole project. I then installed all of the required modules in INSTALL_APPS in settings.py - except one: django_comments.

(env) user:languages user$ pip3 install django_comments
Collecting django_comments
  Using cached https://files.pythonhosted.org/packages/c7/df/3a752f3e393b470087304dd47be6a4bad9867e7ec33963ff022d32143700/django-comments-1.0.0.b.tar.bz2
    ERROR: Command errored out with exit status 1:
     command: /Users/user/.../env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py'"'"'; __file__='"'"'/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py", line 12, in <module>
        version = get_version(),
      File "/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/django_comments/__init__.py", line 4, in get_version
        return u'.'.join(map(unicode, VERSION))
    NameError: name 'unicode' is not defined
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I have found that this may be related to compatibility with Python 3 and that one potential fix is to replace unicode with str. However, this is a module that I would like to work in Python 3 since the Django project relies on this for comments currently. Is it deprecated essentially with no way to work outside of retooling it myself? Thank you.

Upvotes: 0

Views: 178

Answers (1)

nuttalld
nuttalld

Reputation: 11

I know this is a little late but I believe the django_comments was moved to django-contrib-comments. Here should be the latest documentation.

Upvotes: 1

Related Questions