jazzband / django-queued-storage

Provides a proxy for Django storage backends that allows you to upload files locally and eventually serve them remotely
http://django-queued-storage.rtfd.org/
BSD 3-Clause "New" or "Revised" License
317 stars 62 forks source link

TypeError: can't pickle function objects #2

Closed kuno closed 13 years ago

kuno commented 13 years ago

TypeError Traceback (most recent call last)

/home/kuno/utopia/sogoke-django/lib/python2.7/site-packages/queued_storage/backends.pyc in transfer(self, name, cache_key) 182 print(type(self.local)) 183 print(type(self.remote)) --> 184 return self.task.delay(name, self.local, self.remote, cache_key) 185 186 def get_valid_name(self, name):


It seems that queued_storage passed the local and remote lazy backnend to celery. As far as I understand that the most suitable parameters for celery task is simple data structure such as string or number.

So, this caused this error?

vlinhart commented 13 years ago

Hi,

I'm having the same problem: Django Version: 1.3.1 Python Version: 2.6.6 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.humanize', 'django_extensions', 'autofixture', 'debug_toolbar', 'djkombu', 'djcelery', 'queued_storage', 'storages', 'uni_form', 'easy_thumbnails', 'compressor', 'registration', 'socialregistration', 'south', ] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'socialregistration.middleware.FacebookMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware')

Traceback: File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/home/vlinhart/work/denikditete/apps/baby/views.py" in journal_photos_add
  2. Photo.move_from_TempImg(imgs, post.content_type, post_id) File "/home/vlinhart/work/denikditete/apps/baby/models.py" in move_from_TempImg
  3. p.image.save(os.path.split(img.image.path)[1],img.image.file) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/easy_thumbnails/files.py" in save
  4. **kwargs) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/easy_thumbnails/files.py" in save
  5. super(ThumbnailerFieldFile, self).save(name, content, _args, *_kwargs) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/django/db/models/fields/files.py" in save
  6. self.name = self.storage.save(name, content) File "/home/vlinhart/work/denikditete/env/src/queued-storage/queued_storage/backends.py" in save
  7. self.result = self.transfer(name, cache_key=cache_key) File "/home/vlinhart/work/denikditete/env/src/queued-storage/queued_storage/backends.py" in transfer
  8. return self.task.delay(name, self.local, self.remote, cache_key) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/celery/app/task/init.py" in delay
  9. return self.apply_async(args, kwargs) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/celery/app/task/init.py" in apply_async
  10. **options) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/celery/app/amqp.py" in delay_task
  11. send(body, exchange=exchange, **extract_msg_options(kwargs)) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/kombu/connection.py" in _insured
  12. return fun(_args, *_kwargs) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/kombu/compat.py" in send
  13. return self.publish(_args, *_kwargs) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/kombu/messaging.py" in publish
  14. compression, headers) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/kombu/messaging.py" in _prepare
  15. body) = encode(body, serializer=serializer) File "/home/vlinhart/work/denikditete/env/lib/python2.6/site-packages/kombu/serialization.py" in encode
  16. payload = encoder(data) File "/home/vlinhart/work/denikditete/env/lib/python2.6/copy_reg.py" in _reduce_ex
  17. raise TypeError, "can't pickle %s objects" % base.name

Exception Type: TypeError at /dite/5/denik/7/pridat/ Exception Value: can't pickle function objects

Don't know how to solve this. When running in EAGER mode, no such problem occurs.