celery / django-celery

Old Celery integration project for Django

Home Page:http://celery.github.com/django-celery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: can only concatenate list (not "tuple") to list

Novarg opened this issue · comments

There is an error when start celery workers through manage.py command.

celery 3.1.25
django 1.11.2

(mr) vlad-mbp:mr novarg$ ./manage.py celery worker -P gevent -l DEBUG -Q default,celery,ldapsync_tasks,email_release_tasks
master

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/django/core/management/__init__.py", line 205, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 11, in <module>
    class Command(CeleryCommand):
  File "/Users/novarg/.virtualenvs/mr/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 23, in Command
    preload_options)
TypeError: can only concatenate list (not "tuple") to list

It seems that base.preload_options is tuple while others are lists.

Confirming.

Installing 3.2.2 works as a workaround.

You can trigger it with most options, e.g. python manage.py celery list bindings.

Python 3.7.3
django==1.11.21
celery==3.1.26.post2
django-celery==3.3.0

python3 manage.py celery --help

Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 206, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/djcelery/management/commands/celery.py", line 11, in <module>
    class Command(CeleryCommand):
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/djcelery/management/commands/celery.py", line 23, in Command
    preload_options)
TypeError: can only concatenate list (not "tuple") to list

3.2.2 works fine.

Python 3.6.8
django==2.1.10
celery==3.1.26.post2
django-celery==3.3.0

TypeError: can only concatenate list (not "tuple") to list

django-celery 3.2.2 works fine.

Thank you!

Nice elegant solution :)

That fix also closes #560 and #575

Python 3.7.3
django==1.11.21
celery==3.1.26.post2
django-celery==3.3.0

python3 manage.py celery --help

Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 206, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/djcelery/management/commands/celery.py", line 11, in <module>
    class Command(CeleryCommand):
  File "/Users/mmalysh/Development/mining-website/venv/lib/python3.7/site-packages/djcelery/management/commands/celery.py", line 23, in Command
    preload_options)
TypeError: can only concatenate list (not "tuple") to list

3.2.2 works fine.

python3.7 cannot run with celery?

@SUNNYWILLHAPPEN this error not about Python version, you're need django-celery==3.3.1 at least.