[Django]-Celery with Django – MaybeEncodingError: Error sending result

3👍

Apparently you run into a DoesNotExist Exception, which seemingly cannot be pickled (pickle is the standard serialisation method used for celery; you can also not pickle a request object for example).

For a start I would advise you to find where the error occurs.

As a rule of thumb, whenever you access the Model Manger function “get” you should encapsulate that in try-except block.

E.g.:

try:
    block = models.Block.objects.get(id=20)
except models.Block.DoesNotExist:
    pass # this object does not exist, but you script continues.

Leave a comment