gadventures / django-fsm-admin

Mixin and template tags to integrate django-fsm transitions into the django admin.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

try-the-example fails on Python 3.5.1 but succeeds on Python 2.7.11 + wrong path for setup.py

GabLeRoux opened this issue · comments

https://github.com/gadventures/django-fsm-admin#try-the-example

$ git clone git@github.com:gadventures/django-fsm-admin.git
$ cd django-fsm-admin
$ mkvirtualenv fsm_admin
$ pip install -r requirements.txt
$ python fsm_admin/setup.py develop
$ cd example
$ ./manage.py syncdb
$ ./manage.py runserver

Here's what I did:

 gableroux@zbookarch  ~/repos/test 
 git clone git@github.com:gadventures/django-fsm-admin.git
Cloning into 'django-fsm-admin'...
remote: Counting objects: 401, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 401 (delta 0), reused 0 (delta 0), pack-reused 393
Receiving objects: 100% (401/401), 74.72 KiB | 0 bytes/s, done.
Resolving deltas: 100% (188/188), done.
Checking connectivity... done.
 gableroux@zbookarch  ~/repos/test 
 cd django-fsm-admin
 gableroux@zbookarch  ~/repos/test/django-fsm-admin   master 
 mkvirtualenv fsm_admin
Using base prefix '/usr'
New python executable in /home/gableroux/.virtualenvs/fsm_admin/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/gableroux/.virtualenvs/fsm_admin/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/gableroux/.virtualenvs/fsm_admin/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/gableroux/.virtualenvs/fsm_admin/bin/preactivate
virtualenvwrapper.user_scripts creating /home/gableroux/.virtualenvs/fsm_admin/bin/postactivate
virtualenvwrapper.user_scripts creating /home/gableroux/.virtualenvs/fsm_admin/bin/get_env_details
 (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin   master 
 pip install -r requirements.txt
Collecting Django<1.7,>=1.6 (from -r requirements.txt (line 1))
  Using cached Django-1.6.11-py2.py3-none-any.whl
Collecting django-fsm==2.0.1 (from -r requirements.txt (line 2))
Installing collected packages: Django, django-fsm
Successfully installed Django-1.6.11 django-fsm-2.0.1
 (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin   master 
 python fsm_admin/setup.py develop
python: can't open file 'fsm_admin/setup.py': [Errno 2] No such file or directory
 ✘  (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin   master 
 python setup.py develop  
running develop
running egg_info
creating django_fsm_admin.egg-info
writing dependency_links to django_fsm_admin.egg-info/dependency_links.txt
writing requirements to django_fsm_admin.egg-info/requires.txt
writing django_fsm_admin.egg-info/PKG-INFO
writing top-level names to django_fsm_admin.egg-info/top_level.txt
writing manifest file 'django_fsm_admin.egg-info/SOURCES.txt'
reading manifest file 'django_fsm_admin.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.md'
writing manifest file 'django_fsm_admin.egg-info/SOURCES.txt'
running build_ext
Creating /home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django-fsm-admin.egg-link (link to .)
Adding django-fsm-admin 1.2.3 to easy-install.pth file

Installed /home/gableroux/repos/test/django-fsm-admin
Processing dependencies for django-fsm-admin==1.2.3
Searching for django-fsm>=2.1.0
Reading https://pypi.python.org/simple/django-fsm/
Best match: django-fsm 2.3.0
Downloading https://pypi.python.org/packages/source/d/django-fsm/django-fsm-2.3.0.tar.gz#md5=fa5d93ba1ce93cb27543acbcfa24e267
Processing django-fsm-2.3.0.tar.gz
Writing /tmp/easy_install-yvhrawb3/django-fsm-2.3.0/setup.cfg
Running django-fsm-2.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-yvhrawb3/django-fsm-2.3.0/egg-dist-tmp-fu5u6224
creating /home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django_fsm-2.3.0-py3.5.egg
Extracting django_fsm-2.3.0-py3.5.egg to /home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages
Adding django-fsm 2.3.0 to easy-install.pth file

Installed /home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django_fsm-2.3.0-py3.5.egg
Searching for Django==1.6.11
Best match: Django 1.6.11
Adding Django 1.6.11 to easy-install.pth file

Using /home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages
Finished processing dependencies for django-fsm-admin==1.2.3
 (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin   master 
 cd example
 (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin/example   master 
 python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    commands = get_commands()
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/core/management/__init__.py", line 107, in get_commands
    apps = settings.INSTALLED_APPS
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/conf/__init__.py", line 54, in __getattr__
    self._setup(name)
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/conf/__init__.py", line 50, in _setup
    self._configure_logging()
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/conf/__init__.py", line 72, in _configure_logging
    from django.utils.log import DEFAULT_LOGGING
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/utils/log.py", line 7, in <module>
    from django.views.debug import ExceptionReporter, get_exception_reporter_filter
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/views/debug.py", line 12, in <module>
    from django.template import Template, Context, TemplateDoesNotExist
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/template/__init__.py", line 53, in <module>
    from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/template/base.py", line 19, in <module>
    from django.utils.html import escape
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/utils/html.py", line 14, in <module>
    from .html_parser import HTMLParser, HTMLParseError
  File "/home/gableroux/.virtualenvs/fsm_admin/lib/python3.5/site-packages/django/utils/html_parser.py", line 12, in <module>
    HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
 ✘  (fsm_admin)  gableroux@zbookarch  ~/repos/test/django-fsm-admin/example   master 

Tried with Python 3.5.1

Note that it works with Python 2.7.11 ;)

mkvirtualenv -p $(which python2.7)

As you can see, path to setup.py is wrong in the listed commands ;)

Since the demo video is offline, I thought I'd have a look at the example code.
Well, the example is broken on both python2 (2.7.17) and python3 (3.7.5) during the syncdb step:

  • On python3:
    AttributeError: module 'django.conf.global_settings' has no attribute 'TEMPLATE_CONTEXT_PROCESSORS'
    and when it's commented out we reach a different error.
  • On python2:
    Same problem with TEMPLATE_CONTEXT_PROCESSORS
    then cannot import name 'curry' from 'django.utils.functional
    at which point I gave up.

At some point I also got ImportError: cannot import name ConcurrentTransition but never got it to work i nthe end :(

The commands I've done are straight from the documentation, on Fedora 30:

$ git clone git@github.com:gadventures/django-fsm-admin.git
$ cd django-fsm-admin
$ mkvirtualenv fsm_admin
$ pip install -r requirements.txt
$ python setup.py develop
$ cd example
$ python manage.py syncdb      ← failed here
$ python manage.py runserver   ← didn't try that line

Note: mkvirtualenv defaults to python3, to use python2 I added: --python python2